MAKS\AmqpAgent\Config
A class that turns the configuration file into an object.
Example:
```
$config = new Config('path/to/some/config-file.php'); // specific config
$config = new Config(); // default config
```
Synopsis
- // constants
- const DEFAULT_CONFIG_FILE_NAME = 'maks-amqp-agent-config';
- const DEFAULT_CONFIG_FILE_PATH = __DIR__ . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . self::DEFAULT_CONFIG_FILE_NAME . '.php;
- // members
- private $config;
- private $configPath;
- // methods
- public void __construct()
- public mixed __get()
- public void __set()
- public string __toString()
- private void repair()
- public bool has()
- public mixed get()
- public Config set()
- public array getDefaultConfig()
- public array getConfig()
- public Config setConfig()
- public string getConfigPath()
- public Config setConfigPath()
Coverage
Methods | 100% | 13 / 13 |
Lines | 100% | 38 / 38 |
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
128 | UnusedLocalVariable | Avoid unused local variables such as '$value'. |
Constants
Name | Value |
---|---|
DEFAULT_CONFIG_FILE_NAME | 'maks-amqp-agent-config' |
DEFAULT_CONFIG_FILE_PATH | __DIR__ . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . self::DEFAULT_CONFIG_FILE_NAME . '.php |
Members
private
- $config
—
array
The multidimensional configuration array. - $configPath
—
string
Configuration file path.
Methods
private
- repair() — Repairs the config array if first-level of the passed array does not have all keys.
public
- __construct() — Config object constructor.
- __get() — Gets the the given key from the configuration array via public property access notation.
- __set() — Sets the the given key in the configuration array via public property assignment notation.
- __toString() — Returns config file path if the object was casted to a string.
- get() — Gets a value of a key from the configuration array via dot-notation representation.
- getConfig() — Returns the current configuration array.
- getConfigPath() — Returns the path of the configuration file.
- getDefaultConfig() — Returns the default configuration array.
- has() — Checks whether a value exists in the configuration array via dot-notation representation.
- set() — Sets a value of a key from the configuration array via dot-notation representation.
- setConfig() — Sets a new configuration array to be used instead of the current.
- setConfigPath() — Sets the path of the configuration file and rebuilds the internal state of the object.
History
-
2021-01-12T21:10:22+00:00 (commit #686a14a)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Remove return value type hint "self" from methods signature due to unexpected behavior with different PHP versions
-
2021-01-12T21:10:21+00:00 (commit #7272ccf)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Fix typos * Update DocBlocks
-
2021-01-12T21:10:21+00:00 (commit #5db4ff0)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Add additional check for return value of realpath() function in the constructor
-
2021-01-12T21:10:21+00:00 (commit #d09424b)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Add strict types declaration * Add declare(strict_types=1) to all files * Fix file header DocBlock spacing of all files
-
2020-12-03T22:52:56+00:00 (commit #294665a)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Change internal method calls due to last code refactoring
-
2020-12-02T23:38:57+00:00 (commit #04ace71)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Add references to RPC endpoints properties
-
2020-11-29T09:04:02+00:00 (commit #bc035fe)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Add has() method * Add get() method * Add set() method
-
2020-11-29T09:00:10+00:00 (commit #ee8ea8d)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Update config class * Remove deprecated method get() * Remove $configFlat property and all of its references * Update $configPath property to be a realpath * Fix some coding style issues
-
2020-09-23T18:47:06+00:00 (commit #1a3f203)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Fix typos and update DocBlocks * Fix some typos in DockBlocks and other parts of the codebase * Add examples to classes DocBlocks
-
2020-06-13T06:00:57+00:00 (commit #5f20c41)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Add config class * Add Config.php * Add ConfigFileNotFoundException.php