Skip to content

Commit

Permalink
Renamed _get/_set/_include() to getPart/setPart/includeFile()
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Oct 2, 2015
1 parent 2f875ce commit 2fa5e83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/mwlib/src/MW/Config/Abstract.php
Expand Up @@ -25,7 +25,7 @@ abstract class MW_Config_Abstract implements MW_Config_Interface
* @param string $file Path and file name of a config file
* @return array Value of the requested config file
**/
protected function _include( $file )
protected function includeFile( $file )
{
if( !isset( $this->_includeCache[$file] ) ) {
$this->_includeCache[$file] = include $file;
Expand Down
18 changes: 9 additions & 9 deletions lib/mwlib/src/MW/Config/Array.php
Expand Up @@ -46,15 +46,15 @@ public function get( $name, $default = null )
{
$parts = explode( '/', trim( $name, '/' ) );

if( ( $value = $this->_get( $this->_config, $parts ) ) !== null ) {
if( ( $value = $this->getPart( $this->_config, $parts ) ) !== null ) {
return $value;
}

foreach( $this->_paths as $fspath ) {
$this->_config = $this->_load( $this->_config, $fspath, $parts );
}

if( ( $value = $this->_get( $this->_config, $parts ) ) !== null ) {
if( ( $value = $this->getPart( $this->_config, $parts ) ) !== null ) {
return $value;
}

Expand All @@ -71,7 +71,7 @@ public function get( $name, $default = null )
public function set( $name, $value )
{
$parts = explode( '/', trim( $name, '/' ) );
$this->_config = $this->_set( $this->_config, $parts, $value );
$this->_config = $this->setPart( $this->_config, $parts, $value );
}


Expand All @@ -82,12 +82,12 @@ public function set( $name, $value )
* @param array $parts Configuration path parts to look for inside the array
* @return mixed Found value or null if no value is available
*/
protected function _get( $config, $parts )
protected function getPart( $config, $parts )
{
if( ( $current = array_shift( $parts ) ) !== null && isset( $config[$current] ) )
{
if( count( $parts ) > 0 ) {
return $this->_get( $config[$current], $parts );
return $this->getPart( $config[$current], $parts );
}

return $config[$current];
Expand All @@ -104,14 +104,14 @@ protected function _get( $config, $parts )
* @param array $path Configuration path parts
* @param array $value The new value
*/
protected function _set( $config, $path, $value )
protected function setPart( $config, $path, $value )
{
if( ( $current = array_shift( $path ) ) !== null )
{
if( isset( $config[$current] ) ) {
$config[$current] = $this->_set( $config[$current], $path, $value );
$config[$current] = $this->setPart( $config[$current], $path, $value );
} else {
$config[$current] = $this->_set( array(), $path, $value );
$config[$current] = $this->setPart( array(), $path, $value );
}

return $config;
Expand Down Expand Up @@ -150,7 +150,7 @@ protected function _load( array $config, $path, array $parts )
$config[$key] = array();
}

$config[$key] = $this->_merge( $config[$key], $this->_include( $newPath . '.php' ) );
$config[$key] = $this->_merge( $config[$key], $this->includeFile( $newPath . '.php' ) );
}
}

Expand Down

0 comments on commit 2fa5e83

Please sign in to comment.