Public Member Functions | |
__construct (StorageProviderInterface $storage) | |
persist ($accessToken) | |
retrieve ($key) | |
retrieveOneFor (string $username) | |
delete ($object) | |
purge (int $olderThan=86400) | |
![]() | |
__construct (array $args=null) | |
_getSnuzeId () | |
_getSnuzeClass () | |
_ident () | |
Private Attributes | |
$pdo = null | |
Additional Inherited Members | |
![]() | |
debug (string $message, bool $echo=false) | |
info (string $message, bool $echo=false) | |
warning (string $message, bool $echo=false) | |
error (string $message, bool $echo=false) | |
![]() | |
$_snuzeId = null | |
$_snuzeClass = null | |
A data mapper class for AccessToken objects using the MySQL StorageProvider.
This is where abstraction goes to die.
This file is part of Snuze, a PHP client for the Reddit API. Copyright 2019 Shaun Cummiskey shaun @sha unc.c omhttps://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.
snuze\Persistence\MySQL\AccessTokenMapper::__construct | ( | StorageProviderInterface | $storage | ) |
\snuze\Persistence\MySQL\StorageProvider | $storage | A MySQL StorageProvider object |
Implements snuze\Persistence\Interfaces\MapperInterface.
snuze\Persistence\MySQL\AccessTokenMapper::delete | ( | $object | ) |
\snuze\Reddit\AccessToken | $object | The AccessToken to delete |
Implements snuze\Persistence\Interfaces\MapperInterface.
snuze\Persistence\MySQL\AccessTokenMapper::persist | ( | $accessToken | ) |
Insert or update an AccessToken to the MySQL database.
\snuze\Reddit\AccessToken | $accessToken | The AccessToken to persist |
Implements snuze\Persistence\Interfaces\MapperInterface.
snuze\Persistence\MySQL\AccessTokenMapper::purge | ( | int | $olderThan = 86400 | ) |
Delete expired AccessTokens from the database. This is called by Snuze prior to persisting a new token.
int | $olderThan | Tokens that expired more than this many seconds ago will be deleted. Defaults to 1 day. |
Implements snuze\Persistence\Interfaces\AccessTokenMapperInterface.
snuze\Persistence\MySQL\AccessTokenMapper::retrieve | ( | $key | ) |
Get an AccessToken from the database by its token
field.
string | $key | The token field of the AccessToken to retrieve. It's the only unique property of an AccessToken. |
Implements snuze\Persistence\Interfaces\MapperInterface.
snuze\Persistence\MySQL\AccessTokenMapper::retrieveOneFor | ( | string | $username | ) |
Get the newest unexpired access token for the specified user, if one exists.
string | $username | The username for whom to retrieve a token |
Implements snuze\Persistence\Interfaces\AccessTokenMapperInterface.