diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/Config | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/Config')
-rw-r--r-- | core/Config/Compat.php | 278 |
1 files changed, 137 insertions, 141 deletions
diff --git a/core/Config/Compat.php b/core/Config/Compat.php index 2169e3e284..549b2cb9d7 100644 --- a/core/Config/Compat.php +++ b/core/Config/Compat.php @@ -22,149 +22,145 @@ */ class Piwik_Config_Compat_Array { - private $data; - /** - * @var Piwik_Config_Compat - */ - private $parent; - - /** - * Constructor - * - * @param Piwik_Config_Compat $parent - * @param array $data configuration section - */ - public function __construct($parent, array $data) - { - $this->parent = $parent; - $this->data = $data; - } - - /** - * Get value by name - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - $tmp = isset($this->data[$name]) ? $this->data[$name] : false; - return is_array($tmp) ? new Piwik_Config_Compat_Array($this, $tmp) : $tmp; - } - - /** - * Set name, value pair - * - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - if (is_object($value) && get_class($value) == 'Piwik_Config_Compat_Array') - { - $value = $value->toArray(); - } - - $this->data[$name] = $value; - $this->setDirtyBit(); - } - - /** - * Convert object to array - * - * @return array - */ - public function toArray() - { - return $this->data; - } - - /** - * Set dirty bit - */ - public function setDirtyBit() - { - $this->parent->setDirtyBit(); - } + private $data; + /** + * @var Piwik_Config_Compat + */ + private $parent; + + /** + * Constructor + * + * @param Piwik_Config_Compat $parent + * @param array $data configuration section + */ + public function __construct($parent, array $data) + { + $this->parent = $parent; + $this->data = $data; + } + + /** + * Get value by name + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + $tmp = isset($this->data[$name]) ? $this->data[$name] : false; + return is_array($tmp) ? new Piwik_Config_Compat_Array($this, $tmp) : $tmp; + } + + /** + * Set name, value pair + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + if (is_object($value) && get_class($value) == 'Piwik_Config_Compat_Array') { + $value = $value->toArray(); + } + + $this->data[$name] = $value; + $this->setDirtyBit(); + } + + /** + * Convert object to array + * + * @return array + */ + public function toArray() + { + return $this->data; + } + + /** + * Set dirty bit + */ + public function setDirtyBit() + { + $this->parent->setDirtyBit(); + } } class Piwik_Config_Compat { - private $config; - private $data; - private $enabled; - private $dirty; - - /** - * Constructor - */ - public function __construct() - { - $this->config = Piwik_Config::getInstance(); - $this->data = array(); - $this->enabled = true; - $this->dirty = false; - } - - /** - * Destructor - */ - public function __destruct() - { - if ($this->enabled && $this->dirty) - { - $this->config->forceSave(); - } - $this->config->clear(); - } - - /** - * Get value by name - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - if (!isset($this->data[$name])) - { - $this->data[$name] = $this->config->__get($name); - } - - $tmp = $this->data[$name]; - return is_array($tmp) ? new Piwik_Config_Compat_Array($this, $tmp) : $tmp; - } - - /** - * Set name, value pair - * - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - if (is_object($value) && get_class($value) == 'Piwik_Config_Compat_Array') - { - $value = $value->toArray(); - } - - $this->config->__set($name, $value); - $this->dirty = true; - } - - /** - * Set dirty bit - */ - public function setDirtyBit() - { - $this->dirty = true; - } - - /** - * Disable saving of configuration changes - */ - public function disableSavingConfigurationFileUpdates() - { - $this->enabled = false; - } + private $config; + private $data; + private $enabled; + private $dirty; + + /** + * Constructor + */ + public function __construct() + { + $this->config = Piwik_Config::getInstance(); + $this->data = array(); + $this->enabled = true; + $this->dirty = false; + } + + /** + * Destructor + */ + public function __destruct() + { + if ($this->enabled && $this->dirty) { + $this->config->forceSave(); + } + $this->config->clear(); + } + + /** + * Get value by name + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + if (!isset($this->data[$name])) { + $this->data[$name] = $this->config->__get($name); + } + + $tmp = $this->data[$name]; + return is_array($tmp) ? new Piwik_Config_Compat_Array($this, $tmp) : $tmp; + } + + /** + * Set name, value pair + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + if (is_object($value) && get_class($value) == 'Piwik_Config_Compat_Array') { + $value = $value->toArray(); + } + + $this->config->__set($name, $value); + $this->dirty = true; + } + + /** + * Set dirty bit + */ + public function setDirtyBit() + { + $this->dirty = true; + } + + /** + * Disable saving of configuration changes + */ + public function disableSavingConfigurationFileUpdates() + { + $this->enabled = false; + } } |