Settings
in package
implements
Iterator, Countable
Settings Class to read Configuration Files
Tags
Table of Contents
Interfaces
- Iterator
- Countable
Properties
- $confDir : string
- $filePostfix : string
- $filePrefix : string
- $modes : array<string|int, mixed>
Methods
- __clone() : mixed
- {{{
- __construct() : mixed
- {{{ Construct a new Settings Object
- __get() : mixed
- __isset() : mixed
- __set() : mixed
- __unset() : mixed
- addModes() : mixed
- {{{ Adds modes to the default modes programmatically.
- appPath() : mixed
- {{{ Sets the application path where the config/ dirtectory is located If the package path is not set, it is set to the appPath
- buildFileName() : mixed
- {{{ Compose the filename of the configuration File
- count() : int
- Count elements
- create() : mixed
- {{{ Creates a copy of the Settingsobject without the configuration directives
- current() : mixed
- Return the current element
- key() : mixed
- Return the key of the current element
- load() : mixed
- {{{ Load the configuration from the files and merge them
- mergeFile() : mixed
- {{{
- next() : void
- Move forward to next element
- pkgPath() : mixed
- {{{ Sets the package path where the config/ dirtectory for the default and mode files is located
- prefix() : mixed
- {{{
- rewind() : void
- Rewind the Iterator to the first element
- site() : mixed
- {{{
- toArray() : array<string|int, mixed>
- Return the internal settings array
- valid() : bool
- Checks if current position is valid
Properties
$confDir
protected
string
$confDir
= 'config/'
$filePostfix
protected
string
$filePostfix
= 'conf.php'
$filePrefix
protected
string
$filePrefix
= ''
$modes
protected
array<string|int, mixed>
$modes
= ['prod' => 'default', 'test' => 'testing']
Methods
__clone()
{{{
public
__clone() : mixed
__construct()
{{{ Construct a new Settings Object
public
__construct([array<string|int, mixed> $settings = null ][, string $mode = null ]) : mixed
Parameters
- $settings : array<string|int, mixed> = null
-
an array of settings to be used directly
- $mode : string = null
-
One of the keys of $this->modes
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
__unset()
public
__unset(mixed $name) : mixed
Parameters
- $name : mixed
addModes()
{{{ Adds modes to the default modes programmatically.
public
addModes(array<string|int, mixed> $modes) : mixed
Modes can and should be configured in the default configurration File
Parameters
- $modes : array<string|int, mixed>
-
an array with the modes to add. 'index' => 'prefix'
appPath()
{{{ Sets the application path where the config/ dirtectory is located If the package path is not set, it is set to the appPath
public
appPath([string $path = null ]) : mixed
Parameters
- $path : string = null
buildFileName()
{{{ Compose the filename of the configuration File
public
buildFileName([mixed $type = null ]) : mixed
Parameters
- $type : mixed = null
count()
Count elements
public
count() : int
Tags
Return values
intcreate()
{{{ Creates a copy of the Settingsobject without the configuration directives
public
create([array<string|int, mixed>|null $settings = null ]) : mixed
Parameters
- $settings : array<string|int, mixed>|null = null
current()
Return the current element
public
current() : mixed
Tags
key()
Return the key of the current element
public
key() : mixed
Tags
load()
{{{ Load the configuration from the files and merge them
public
load([array<string|int, mixed> $settings = null ]) : mixed
Parameters
- $settings : array<string|int, mixed> = null
-
uses the Settings as an Array.
mergeFile()
{{{
public
mergeFile() : mixed
next()
Move forward to next element
public
next() : void
Tags
pkgPath()
{{{ Sets the package path where the config/ dirtectory for the default and mode files is located
public
pkgPath(string $path) : mixed
Parameters
- $path : string
prefix()
{{{
public
prefix([string|null $prefix = null ]) : mixed
Parameters
- $prefix : string|null = null
rewind()
Rewind the Iterator to the first element
public
rewind() : void
Tags
site()
{{{
public
site(string $site) : mixed
Parameters
- $site : string
toArray()
Return the internal settings array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>valid()
Checks if current position is valid
public
valid() : bool