Snuze  0.8.1
snuze\SnuzeFactory Class Reference

Public Member Functions

 __construct (array $parameters)
 
 getSnuze ()
 

Public Attributes

const REQUIRED_EXTS = ['curl']
 

Private Member Functions

 initializeLogger ()
 

Private Attributes

 $config
 

Detailed Description

The SnuzeFactory is responsible for accepting and validating configuration parameters, initializing a sane environment, then creating and returning a Snuze object. That's kind of a lot for a factory, but it's not really a builder and it's not really just a DI container either, so "factory" it is.


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\SnuzeFactory::__construct ( array  $parameters)

Constructor. Accepts an array of configuration parameters.

Parameters
array$parameters
Exceptions

Member Function Documentation

◆ getSnuze()

snuze\SnuzeFactory::getSnuze ( )

Build and return a configured Snuze instance.

Returns
\snuze\Snuze A configured Snuze instance
Exceptions

◆ initializeLogger()

snuze\SnuzeFactory::initializeLogger ( )
private

Initialize the file logger. There's no return; the logger class is a singleton.

Returns
void
Exceptions

Member Data Documentation

◆ $config

snuze\SnuzeFactory::$config
private
Initial value:
= [
'auth.client_id' => '',
'auth.client_secret' => '',
'auth.username' => '',
'auth.password' => '',
'auth.user_agent' => '',
'autosleep' => true,
'log.filename' => 'snuze.log',
'log.label' => '',
'log.severity' => 'WARNING',
'storage.enabled' => true,
'storage.namespace' => '\snuze\Persistence\SQLite',
'storage.parameters' => ['filename' => 'snuze.sqlite'],
]

◆ REQUIRED_EXTS

const snuze\SnuzeFactory::REQUIRED_EXTS = ['curl']

The PHP extensions that must be installed/available for the Snuze core components to work. A storage provider, if enabled, may define its own additional required extensions.


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