Snuze  0.8.1
snuze\Persistence\AbstractStorageProvider Class Reference
Inheritance diagram for snuze\Persistence\AbstractStorageProvider:

Public Member Functions

 getMapper (string $objectClass)
 
 getRequiredExtensionNames ()
 
 init ()
 
- Public Member Functions inherited from snuze\SnuzeObject
 __construct (array $args=null)
 
 _getSnuzeId ()
 
 _getSnuzeClass ()
 
 _ident ()
 
- Public Member Functions inherited from snuze\Persistence\Interfaces\StorageProviderInterface
 __construct (array $configurationParameters=[])
 

Static Protected Attributes

static $mappers = []
 

Additional Inherited Members

- Protected Member Functions inherited from snuze\SnuzeObject
 debug (string $message, bool $echo=false)
 
 info (string $message, bool $echo=false)
 
 warning (string $message, bool $echo=false)
 
 error (string $message, bool $echo=false)
 
- Protected Attributes inherited from snuze\SnuzeObject
 $_snuzeId = null
 
 $_snuzeClass = null
 

Detailed Description

The AbstractStorageProvider contains basic implementations for two of the methods required by StorageProviderInterface; namely, getMapper() and getRequiredExtensionNames(). Depending on the type of storage involved, these "stubs" are likely capable of standing on their own, and probably don't need to be overridden.

If you want to develop your own Snuze storage provider, it will need to extend this class, implementing init() at the very least. Have a look at the MySQL storage provider to see an example.


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

◆ getMapper()

snuze\Persistence\AbstractStorageProvider::getMapper ( string  $objectClass)

Given the short class name of an object (e.g. 'AccessToken' or 'Link'), return a corresponding Mapper to handle that object, as implemented by this particular storage provider. If this storage provider hasn't implemented a Mapper for the requested type, an exception is thrown.

Parameters
string$objectClassThe short class name of the object a Mapper is desired for, e.g. 'Subreddit' or 'Link'
Returns
\snuze\Persistence\Interfaces\MapperInterface A Mapper for the requested object type
Exceptions

Implements snuze\Persistence\Interfaces\StorageProviderInterface.

◆ getRequiredExtensionNames()

snuze\Persistence\AbstractStorageProvider::getRequiredExtensionNames ( )

Return the array of extensions this provider requires in order to operate properly.

Returns
array

Implements snuze\Persistence\Interfaces\StorageProviderInterface.

◆ init()

snuze\Persistence\AbstractStorageProvider::init ( )
abstract

Your storage provider must implement this method to perform whatever actions are necessary to initialize it; for example, opening a PDO connection, making sure certain data tables exist, etc.

Returns
void

Implements snuze\Persistence\Interfaces\StorageProviderInterface.


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