Copied!

Get settings file. File should be a PHP file returning an array of key / value pairs. Key is the variable to be set in the class to the value provided.

Abstract
Methods
public __call(string $name, array $args) : ?string
 
  • param array<string,mixed> $args
public __construct(string $serverName = '')
public __get(string $field) : ?mixed
 

Allows for $object->field syntax

Unset fields will return null

public __set(string $field, ?mixed $value) : void
 

Allows for $object->field = $x syntax

public addFields(array $fields) : static
 

Add fields

  • param array<string,mixed> $fields key / value field pairs that will be added to the existing settings
public empty() : bool
public getFields() : array
 
  • return array<string,mixed>
public getLoadedFileName() : string
public optional(string $key) : ?mixed
public save() : bool
public setFields(array $fields) : static
 

Set the fields

  • param array<string,mixed> $fields key / value field pairs that will now be valid fields
Properties
private string $fileName = 'NOT FOUND'
private string $serverName
private array $settings = []
 
  • var array<string,mixed>
Methods
private getFileName(string $fileName) : string
private load() : void
 

Load settings file from config directory in project root. The following is the file search order:

  • Server name directory, class base name.
  • If server name file is not found, then defaults to class name in config directory
private loadFile(string $configName) : array
 
  • return array<string,mixed>
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration