diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-10-27 14:25:05 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-10-27 14:25:05 +0200 |
commit | 5232ba07752ffa783d03754c3a869d9f73ccae69 (patch) | |
tree | dd199caa518dcfdabfb4fd221ca91a410e7a1146 /system/core | |
parent | 60826db46d3f9ceabcc280c494a975007423e64a (diff) |
Docblock improvements to the Config library and remove CI_Config::_assign_to_config()
Existance of _assign_to_config() is pointless as this method
consists just of a foreach calling CI_Config::set_item() and
is only called by CodeIgniter.php - moved that foreach() in
there instead.
Diffstat (limited to 'system/core')
-rw-r--r-- | system/core/CodeIgniter.php | 7 | ||||
-rw-r--r-- | system/core/Config.php | 80 | ||||
-rw-r--r-- | system/core/Exceptions.php | 2 |
3 files changed, 40 insertions, 49 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index f3592eaf9..324b4d849 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -130,9 +130,12 @@ $CFG =& load_class('Config', 'core'); // Do we have any manually set config items in the index.php file? - if (isset($assign_to_config)) + if (isset($assign_to_config) && is_array($assign_to_config)) { - $CFG->_assign_to_config($assign_to_config); + foreach ($assign_to_config as $key => $value) + { + $CFG->set_item($key, $value); + } } /* diff --git a/system/core/Config.php b/system/core/Config.php index e78128c76..152e9af68 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -26,7 +26,7 @@ */ /** - * CodeIgniter Config Class + * Config Class * * This class contains functions that enable config files to be managed * @@ -41,29 +41,31 @@ class CI_Config { /** * List of all loaded config values * - * @var array + * @var array */ public $config = array(); /** * List of all loaded config files * - * @var array + * @var array */ public $is_loaded = array(); /** * List of paths to search when trying to load a config file. - * This must be public as it's used by the Loader class. * - * @var array + * @used-by CI_Loader Must be public + * @var array */ public $_config_paths = array(APPPATH); /** - * Constructor + * Class constructor * - * Sets the $config data from the primary config.php file as a class variable + * Sets the $config data from the primary config.php file as a class variable. + * + * @return void */ public function __construct() { @@ -93,10 +95,10 @@ class CI_Config { /** * Load Config File * - * @param string the config file name - * @param bool if configuration values should be loaded into their own section - * @param bool true if errors should just return false, false if an error message should be displayed - * @return bool if the file was loaded correctly + * @param string $file Configuration file name + * @param bool $use_sections Whether configuration values should be loaded into their own section + * @param bool $fail_gracefully Whether to just return FALSE or display an error message + * @return bool TRUE if the file was loaded correctly or FALSE on failure */ public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { @@ -183,9 +185,9 @@ class CI_Config { /** * Fetch a config file item * - * @param string the config item name - * @param string the index name - * @return string + * @param string $item Config item name + * @param string $index Index name + * @return string|bool The configuration item or FALSE on failure */ public function item($item, $index = '') { @@ -200,10 +202,10 @@ class CI_Config { // -------------------------------------------------------------------- /** - * Fetch a config file item - adds slash after item (if item is not empty) + * Fetch a config file item with slash appended (if not empty) * - * @param string the config item name - * @return string + * @param string $item Config item name + * @return string|bool The configuration item or FALSE on failure */ public function slash_item($item) { @@ -223,9 +225,12 @@ class CI_Config { /** * Site URL + * * Returns base_url . index_page [. uri_string] * - * @param mixed the URI string or an array of segments + * @uses CI_Config::_uri_string() + * + * @param string|string[] $uri URI string or an array of segments * @return string */ public function site_url($uri = '') @@ -264,9 +269,12 @@ class CI_Config { /** * Base URL + * * Returns base_url [. uri_string] * - * @param string $uri + * @uses CI_Config::_uri_string() + * + * @param string|string[] $uri URI string or an array of segments * @return string */ public function base_url($uri = '') @@ -277,9 +285,12 @@ class CI_Config { // ------------------------------------------------------------- /** - * Build URI string for use in Config::site_url() and Config::base_url() + * Build URI string + * + * @used-by CI_Config::site_url() + * @used-by CI_Config::base_url() * - * @param mixed $uri + * @param string|string[] $uri URI string or an array of segments * @return string */ protected function _uri_string($uri) @@ -318,8 +329,8 @@ class CI_Config { /** * Set a config file item * - * @param string the config item key - * @param string the config item value + * @param string $item Config item key + * @param string $value Config item value * @return void */ public function set_item($item, $value) @@ -327,29 +338,6 @@ class CI_Config { $this->config[$item] = $value; } - // -------------------------------------------------------------------- - - /** - * Assign to Config - * - * This function is called by the front controller (CodeIgniter.php) - * after the Config class is instantiated. It permits config items - * to be assigned or overriden by variables contained in the index.php file - * - * @param array - * @return void - */ - public function _assign_to_config($items = array()) - { - if (is_array($items)) - { - foreach ($items as $key => $val) - { - $this->set_item($key, $val); - } - } - } - } /* End of file Config.php */ diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index c0caf2e7d..556257729 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -130,7 +130,7 @@ class CI_Exceptions { * @param string $heading Page heading * @param string|string[] $message Error message * @param string $template Template name - * @param int $statis_code (default: 500) + * @param int $status_code (default: 500) * * @return string Error page output */ |