PhpConfigFile
Php Config file loader and writer
Table of Contents
Properties
- $comments : array<string|int, mixed>
- Config array comments
Methods
- include() : array<string|int, mixed>|null
- Include file
- includeConfigFile() : array<string|int, mixed>|null
- Include config file
- includePhpArray() : array<string|int, mixed>|null
- Include php array
- saveConfigFile() : bool
- Save config file
- exportArray() : string
- Export array as text
- exportConfig() : string
- Export config as text
- exportItem() : string
- Export item as text
- getCommentsText() : string
- Get array imtem comment as text
- setComment() : void
- Set array key comment
- determineMaxTabs() : int
- Get max tabs count
- determineTabs() : int
- Get tabs count for array key
- getFileContent() : string
- Return config file content
- getFileContentHeader() : string
- Get config file header
- getTabs() : string
- Get tabs text
Properties
$comments
Config array comments
protected
array<string|int, mixed>
$comments
= []
Methods
include()
Include file
public
include(string $fileName) : array<string|int, mixed>|null
Parameters
- $fileName : string
-
Full file name
Return values
array<string|int, mixed>|nullincludeConfigFile()
Include config file
public
includeConfigFile(string $fileName[, string|null $extensionName = null ]) : array<string|int, mixed>|null
Parameters
- $fileName : string
- $extensionName : string|null = null
Return values
array<string|int, mixed>|nullincludePhpArray()
Include php array
public
includePhpArray(string $fileName) : array<string|int, mixed>|null
Parameters
- $fileName : string
Return values
array<string|int, mixed>|nullsaveConfigFile()
Save config file
public
saveConfigFile(string $fileName, array<string|int, mixed> $data) : bool
Parameters
- $fileName : string
- $data : array<string|int, mixed>
Return values
boolexportArray()
Export array as text
protected
exportArray(array<string|int, mixed> $data, string $arrayKey[, int $currentTab = 1 ]) : string
Parameters
- $data : array<string|int, mixed>
- $arrayKey : string
- $currentTab : int = 1
Return values
stringexportConfig()
Export config as text
protected
exportConfig(array<string|int, mixed> $data) : string
Parameters
- $data : array<string|int, mixed>
Return values
stringexportItem()
Export item as text
protected
exportItem(string|int $key, mixed $value, int $maxTabs[, int $startTab = 1 ]) : string
Parameters
- $key : string|int
- $value : mixed
- $maxTabs : int
- $startTab : int = 1
Return values
stringgetCommentsText()
Get array imtem comment as text
protected
getCommentsText(string $key) : string
Parameters
- $key : string
Return values
stringsetComment()
Set array key comment
protected
setComment(string $comment, string $key) : void
Parameters
- $comment : string
- $key : string
determineMaxTabs()
Get max tabs count
private
determineMaxTabs(array<string|int, mixed> $data[, int $tabSize = 4 ]) : int
Parameters
- $data : array<string|int, mixed>
- $tabSize : int = 4
Return values
intdetermineTabs()
Get tabs count for array key
private
determineTabs(string $key[, int $tabSize = 4 ]) : int
Parameters
- $key : string
- $tabSize : int = 4
Return values
intgetFileContent()
Return config file content
private
getFileContent(array<string|int, mixed> $data) : string
Parameters
- $data : array<string|int, mixed>
Return values
stringgetFileContentHeader()
Get config file header
private
getFileContentHeader() : string
Return values
stringgetTabs()
Get tabs text
private
getTabs(int $count) : string
Parameters
- $count : int