com\setasign\SetaFramework\Config\Reader

Ini Class Config Reader Ini

File: /SetaFramework/src/Config/Reader/Ini.php

Class hierarchy

Implements

Summary

Properties

$filename

protected string Ini::$filename

Contains the filename of the config file

$raw

protected bool Ini::$raw

Use INI_SCANNER_RAW(true) or INI_SCANNER_TYPED(false)?

$sections

protected ?array Ini::$sections

Contains all needed sections


Methods

__construct()

public Ini::__construct (
string $filename,
null|string|array $sections = null,
bool $raw = false
)

Constructor

Parameters
$filename : string
 
$sections : null|string|array
 
$raw : bool
 
Exceptions

Throws \InvalidArgumentException

flatten()

protected Ini::flatten (
array $parsedIni
): array

Ini entries with [] in the key name will be arrays.

Because of this we have to flatten the array otherwise we would have to implement diffent handling logics in read.

Parameters
$parsedIni : array
 
Exceptions

Throws \com\setasign\SetaFramework\Exception If an invalid key name was used

getAbsolutePath()

private Ini::getAbsolutePath (
string $path
): string

Gets a absolute path of the path

Used for all path definitions in config file.

If the path is a relative path the application path dir scope will prepend before the path.

Parameters
$path : string
 

readNestedConfig()

protected Ini::readNestedConfig (
string $path
): array
Parameters
$path : string
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

readSection()

protected Ini::readSection (
string $sectionName,
array &$sections,
array &$result
): void

Search a required section in the $sections array and add found values to $result array

This method call itself for every inherited section.

Parameters
$sectionName : string

Name of the section which we search

$sections : array

All parsed sections with their values. Reference is used to save performance, the array shouldn't be changed in this method.

$result : array
 

readSections()

protected Ini::readSections (
array $parsedIni,
array $sections
): array
Parameters
$parsedIni : array
 
$sections : array