Snuze  0.8.1
snuze\Persistence\Interfaces\AccessTokenMapperInterface Interface Reference
Inheritance diagram for snuze\Persistence\Interfaces\AccessTokenMapperInterface:

Public Member Functions

 retrieveOneFor (string $username)
 
 purge (int $olderThan=86400)
 
- Public Member Functions inherited from snuze\Persistence\Interfaces\MapperInterface
 __construct (StorageProviderInterface $storage)
 
 persist ($object)
 
 retrieve ($key)
 
 delete ($object)
 

Detailed Description

The AccessTokenMapperInterface is part of the storage provider design.

It defines additional methods that must be implemented for persisting an AccessToken object, above and beyond the requirements in MapperInterface.


This file is part of Snuze, a PHP client for the Reddit API. Copyright 2019 Shaun Cummiskey shaun.nosp@m.@sha.nosp@m.unc.c.nosp@m.om https://shaunc.com/ Repository: https://github.com/snuze/snuze/ Documentation: https://snuze.shaunc.com/

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Member Function Documentation

◆ purge()

snuze\Persistence\Interfaces\AccessTokenMapperInterface::purge ( int  $olderThan = 86400)

Implementers must expose a method to delete stale AccessToken objects from storage.

Parameters
int$olderThanA number of seconds. The method should delete any AccessTokens that expired more than this many seconds ago.

Implemented in snuze\Persistence\SQLite\AccessTokenMapper, and snuze\Persistence\MySQL\AccessTokenMapper.

◆ retrieveOneFor()

snuze\Persistence\Interfaces\AccessTokenMapperInterface::retrieveOneFor ( string  $username)

Implementers must expose a method to return the newest unexpired and valid AccessToken for a given user, if one exists.

Parameters
string$usernameThe username for whom to look for an AccessToken
Returns
\snuze\Reddit\AccessToken|null

Implemented in snuze\Persistence\SQLite\AccessTokenMapper, and snuze\Persistence\MySQL\AccessTokenMapper.


The documentation for this interface was generated from the following file: