class INI (View source)

The GenericDatabase\Helpers\Parsers\INI class provides methods for working with INI files.

It includes a method to check if a given argument is a valid INI file and a method to parse a valid INI file and return its contents as an array.

Example Usage:

// Check if a file is a valid INI file
$isValid = INI::isValidINI('config.ini');

Output: true

// Parse an INI file and retrieve its contents as an array
$contents = INI::parseINI('config.ini');

Output: ['key1' => 'value1', 'key2' => 'value2']

Main functionalities:

  • Check if a given argument is a valid INI file
  • Parse a valid INI file and return its contents as an array

Methods:

  • isValidINI($ini): Checks if a given argument is a valid INI file. Returns true if the argument is a valid INI file, false otherwise.
  • parseINI($ini): Parses a valid INI file and returns its contents as an array.

Methods

static bool
isValidINI(mixed $ini)

Check if a given argument is a valid INI file.

static array
parseINI(string $ini)

Parse a valid INI file and return its contents as an array.

static array
parseIniFile(string $filepath)

Parse an INI file and return its contents as an associative array.

Details

static bool isValidINI(mixed $ini)

Check if a given argument is a valid INI file.

Parameters

mixed $ini

The argument to be tested.

Return Value

bool

True if the argument is a valid INI file, false otherwise.

static array parseINI(string $ini)

Parse a valid INI file and return its contents as an array.

Parameters

string $ini

The INI file to be parsed.

Return Value

array

The contents of the INI file as an array.

static array parseIniFile(string $filepath)

Parse an INI file and return its contents as an associative array.

Parameters

string $filepath

The path to the INI file.

Return Value

array

The contents of the INI file as an associative array.