ConfigFile
extends Base
in package
Class to change configuration in file.
Table of Contents
- TYPES = ['main', 'db', 'performance', 'module', 'api', 'debug', 'developer', 'security', 'securityKeys', 'relation', 'sounds', 'search', 'component', 'layout']
- Types of configuration files
- $value : array<string|int, mixed>
- $component : string|null
- $license : string
- $path : string
- $template : array<string|int, mixed>
- $templatePath : string
- $type : string
- __construct() : mixed
- ConfigFile constructor.
- create() : mixed
- Create configuration file.
- get() : mixed
- Function to get the value for a given key.
- getArray() : array<string|int, mixed>
- Function to get the array values for a given key.
- getData() : array<string|int, mixed>
- Function to get all the values of the Object.
- getForHtml() : mixed
- Function to get the html encoded value for a given key.
- getForSql() : mixed
- Function to get the value if its safe to use for SQL Query (column).
- getKeys() : array<string|int, string>
- Function to get keys.
- getTemplate() : mixed
- Gets template data.
- has() : bool
- Function to check if the key exists.
- isEmpty() : bool
- Function to check if the key is empty.
- remove() : mixed
- Function to remove the value.
- sanitize() : mixed
- Function for data sanitize.
- set() : self
- Function to set the value for a given key.
- setData() : $this
- Function to set all the values.
- validate() : bool
- Function for data validation.
- getClassName() : string
- Gets class name.
- loadTemplate() : mixed
- Load configuration template.
Constants
TYPES
Types of configuration files
public
mixed
TYPES
= ['main', 'db', 'performance', 'module', 'api', 'debug', 'developer', 'security', 'securityKeys', 'relation', 'sounds', 'search', 'component', 'layout']
Properties
$value
protected
array<string|int, mixed>
$value
Values
$component
private
string|null
$component
Component name
$license
private
string
$license
= 'Configuration file.
This file is auto-generated.
@package Config
@copyright YetiForce S.A.
@license YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
'
License
$path
private
string
$path
Path to the configuration file
$template
private
array<string|int, mixed>
$template
= []
Template data
$templatePath
private
string
$templatePath
Path to the configuration template file
$type
private
string
$type
Type of configuration file
Methods
__construct()
ConfigFile constructor.
public
__construct(string $type[, string|null $component = '' ]) : mixed
Parameters
- $type : string
- $component : string|null = ''
Tags
Return values
mixed —create()
Create configuration file.
public
create() : mixed
Tags
Return values
mixed —get()
Function to get the value for a given key.
public
get(string $key) : mixed
Parameters
- $key : string
Return values
mixed —Value for the given key
getArray()
Function to get the array values for a given key.
public
getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
- $key : string
- $value : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getData()
Function to get all the values of the Object.
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getForHtml()
Function to get the html encoded value for a given key.
public
getForHtml(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getForSql()
Function to get the value if its safe to use for SQL Query (column).
public
getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
- $key : string
- $skipEmtpy : bool = true
-
Skip the check if string is empty
Return values
mixed —Value for the given key
getKeys()
Function to get keys.
public
getKeys() : array<string|int, string>
Return values
array<string|int, string> —getTemplate()
Gets template data.
public
getTemplate([string|null $key = null ]) : mixed
Parameters
- $key : string|null = null
Return values
mixed —has()
Function to check if the key exists.
public
has(string $key) : bool
Parameters
- $key : string
Return values
bool —isEmpty()
Function to check if the key is empty.
public
isEmpty(string $key) : bool
Parameters
- $key : string
Return values
bool —remove()
Function to remove the value.
public
remove(string $key) : mixed
Parameters
- $key : string
Return values
mixed —sanitize()
Function for data sanitize.
public
sanitize(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Tags
Return values
mixed —set()
Function to set the value for a given key.
public
set(string $key, mixed $value) : self
Parameters
- $key : string
- $value : mixed
Tags
Return values
self —setData()
Function to set all the values.
public
setData(mixed $values) : $this
Parameters
- $values : mixed
Return values
$this —validate()
Function for data validation.
public
validate(string $key, mixed $value) : bool
Parameters
- $key : string
- $value : mixed
Tags
Return values
bool —getClassName()
Gets class name.
private
getClassName() : string
Return values
string —loadTemplate()
Load configuration template.
private
loadTemplate() : mixed