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


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 Repository: Documentation:

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

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.


Member Function Documentation

◆ getSnuze()

snuze\SnuzeFactory::getSnuze ( )

Build and return a configured Snuze instance.

\snuze\Snuze A configured Snuze instance

◆ initializeLogger()

snuze\SnuzeFactory::initializeLogger ( )

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


Member Data Documentation

◆ $config

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'],


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: