Skip to content

Commit

Permalink
Merge pull request #11034 from cakephp/config-api-docs
Browse files Browse the repository at this point in the history
Pull in the relevant examples from the API
  • Loading branch information
markstory committed Aug 14, 2017
2 parents 60f38e0 + d71a990 commit 0a13ca7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Core/Configure/ConfigEngineInterface.php
Expand Up @@ -21,7 +21,9 @@ interface ConfigEngineInterface
{

/**
* Read method is used for reading configuration information from sources.
* Read a configuration file/storage key
*
* This method is used for reading configuration information from sources.
* These sources can either be static resources like files, or dynamic ones like
* a database, or other datasource.
*
Expand All @@ -31,7 +33,7 @@ interface ConfigEngineInterface
public function read($key);

/**
* Dumps the configure data into source.
* Dumps the configure data into the storage key/file of the given `$key`.
*
* @param string $key The identifier to write to.
* @param array $data The data to dump.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Configure/Engine/IniConfig.php
Expand Up @@ -42,7 +42,7 @@
*
* `Configure::read('section.key');
*
* You can combine `.` separated values with sections to create more deeply
* You can also use `.` separated values in section names to create more deeply
* nested structures.
*
* IniConfig also manipulates how the special ini values of
Expand Down
14 changes: 14 additions & 0 deletions src/Core/Configure/Engine/JsonConfig.php
Expand Up @@ -21,6 +21,20 @@
/**
* JSON engine allows Configure to load configuration values from
* files containing JSON strings.
*
* An example JSON file would look like::
*
* ```
* {
* "debug": false,
* "App": {
* "namespace": "MyApp"
* },
* "Security": {
* "salt": "its-secret"
* }
* }
* ```
*/
class JsonConfig implements ConfigEngineInterface
{
Expand Down
17 changes: 17 additions & 0 deletions src/Core/Configure/Engine/PhpConfig.php
Expand Up @@ -24,6 +24,23 @@
*
* Files compatible with PhpConfig should return an array that
* contains all of the configuration data contained in the file.
*
* An example configuration file would look like::
*
* ```
* <?php
* return [
* 'debug' => 0,
* 'Security' => [
* 'salt' => 'its-secret'
* ],
* 'App' => [
* 'namespace' => 'App'
* ]
* ];
* ```
*
* @see Cake\Core\Configure::load() for how to load custom configuration files.
*/
class PhpConfig implements ConfigEngineInterface
{
Expand Down

0 comments on commit 0a13ca7

Please sign in to comment.