Skip to content

Commit

Permalink
Harden interface for Config engine classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Nov 21, 2014
1 parent 94ffe12 commit b52204b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Core/Configure/ConfigEngineInterface.php
Expand Up @@ -36,6 +36,6 @@ public function read($key);
* @param array $data The data to dump.
* @return bool True on success or false on failure.
*/
public function dump($key, $data);
public function dump($key, array $data);

}
8 changes: 4 additions & 4 deletions src/Core/Configure/Engine/IniConfig.php
Expand Up @@ -72,12 +72,12 @@ class IniConfig implements ConfigEngineInterface {
* Build and construct a new ini file parser. The parser can be used to read
* ini files that are on the filesystem.
*
* @param string $path Path to load ini config files from. Defaults to CONFIG.
* @param string $section Only get one section, leave null to parse and fetch
* @param string|null $path Path to load ini config files from. Defaults to CONFIG.
* @param string|null $section Only get one section, leave null to parse and fetch
* all sections in the ini file.
*/
public function __construct($path = null, $section = null) {
if (!$path) {
if ($path === null) {
$path = CONFIG;
}
$this->_path = $path;
Expand Down Expand Up @@ -154,7 +154,7 @@ protected function _parseNestedValues($values) {
* @param array $data The data to convert to ini file.
* @return int Bytes saved.
*/
public function dump($key, $data) {
public function dump($key, array $data) {
$result = array();
foreach ($data as $k => $value) {
$isSection = false;
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Configure/Engine/PhpConfig.php
Expand Up @@ -37,10 +37,10 @@ class PhpConfig implements ConfigEngineInterface {
/**
* Constructor for PHP Config file reading.
*
* @param string $path The path to read config files from. Defaults to CONFIG.
* @param string|null $path The path to read config files from. Defaults to CONFIG.
*/
public function __construct($path = null) {
if (!$path) {
if ($path === null) {
$path = CONFIG;
}
$this->_path = $path;
Expand Down Expand Up @@ -84,7 +84,7 @@ public function read($key) {
* @param array $data Data to dump.
* @return int Bytes saved.
*/
public function dump($key, $data) {
public function dump($key, array $data) {
$contents = '<?php' . "\n" . '$config = ' . var_export($data, true) . ';';

$filename = $this->_getFilePath($key);
Expand Down

0 comments on commit b52204b

Please sign in to comment.