Snuze  0.8.1
snuze\Persistence\SQLite\StorageProvider Class Reference
Inheritance diagram for snuze\Persistence\SQLite\StorageProvider:

Public Member Functions

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

Public Attributes

const REQUIRED_EXTS = ['pdo_sqlite']
 

Private Member Functions

 validateSchema ()
 
 createSchema ()
 

Private Attributes

 $filename = null
 
 $pdo = null
 

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
 
- Static Protected Attributes inherited from snuze\Persistence\AbstractStorageProvider
static $mappers = []
 

Detailed Description

This is the SQLite storage provider class. It provides the very basic functionality required for Snuze to persist AccessTokens to a data file.

If you want to develop your own Snuze storage provider, you should look at the included MySQL storage provider instead. This one doesn't do enough to be a useful 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.

Constructor & Destructor Documentation

◆ __construct()

snuze\Persistence\SQLite\StorageProvider::__construct ( array  $configurationParameters = [])

Creates a new SQLite\StorageProvider object.

You must pass an array with a single element whose key is 'filename' and whose value is the path to the target SQLite data file. If that file doesn't exist, it will be created when init() is called.

Parameters
string[]$configurationParameters An array with an element named 'filename' pointing to the target data file
Exceptions

Implements snuze\Persistence\Interfaces\StorageProviderInterface.

Member Function Documentation

◆ createSchema()

snuze\Persistence\SQLite\StorageProvider::createSchema ( )
private

Create the expected schema. Called by init() if validateSchema() returns false.

Returns
bool
Exceptions

◆ getPdo()

snuze\Persistence\SQLite\StorageProvider::getPdo ( )

Get the PDO object

Returns
\PDO

◆ init()

snuze\Persistence\SQLite\StorageProvider::init ( )

Open a PDO handle to the data file, and make sure the access_tokens table exists. If the table isn't there, create it.

Returns
void
Exceptions

Implements snuze\Persistence\Interfaces\StorageProviderInterface.

References snuze\Persistence\SQLite\StorageProvider\createSchema(), and snuze\Persistence\SQLite\StorageProvider\validateSchema().

◆ validateSchema()

snuze\Persistence\SQLite\StorageProvider::validateSchema ( )
private

Test for the presence of an expected table in the data file. Called by init().

Returns
bool

Member Data Documentation

◆ REQUIRED_EXTS

const snuze\Persistence\SQLite\StorageProvider::REQUIRED_EXTS = ['pdo_sqlite']

PHP extensions required by this storage provider


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