Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Whitespace, comments, and code coverage tweaks

Signed-off-by: dchill42 <dchill42@gmail.com>
commit b069d729c86ce12738aba25ba35b2682677814f1 1 parent 0c31b22
@dchill42 authored
View
26 index.php
@@ -9,7 +9,7 @@
* Licensed under the Open Software License version 3.0
*
* This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
+ * bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
* http://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to obtain it
@@ -36,9 +36,9 @@
*
* This can be set to anything, but default usage is:
*
- * development
- * testing
- * production
+ * development
+ * testing
+ * production
*
* NOTE: If you change these, also change the error_reporting() code below
*/
@@ -76,7 +76,7 @@
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" folder.
- * Include the path if the folder is not in the same directory
+ * Include the path if the folder is not in the same directory
* as this file.
*/
$system_path = 'system';
@@ -131,11 +131,11 @@
*
* Un-comment the $routing array below to use this feature
*/
- // The directory name, relative to the "controllers" folder. Leave blank
+ // The directory name, relative to the "controllers" folder. Leave blank
// if your controller is not in a sub-folder within the "controllers" folder
// $routing['directory'] = '';
- // The controller class file name. Example: mycontroller
+ // The controller class file name. Example: mycontroller
// $routing['controller'] = '';
// The controller function you wish to be called.
@@ -143,7 +143,7 @@
/*
* -------------------------------------------------------------------
- * CUSTOM CONFIG VALUES
+ * CUSTOM CONFIG VALUES
* -------------------------------------------------------------------
*
* The $assign_to_config array below will be passed dynamically to the
@@ -160,12 +160,12 @@
// --------------------------------------------------------------------
-// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
+// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
/*
* ---------------------------------------------------------------
- * Resolve the system path for increased reliability
+ * Resolve the system path for increased reliability
* ---------------------------------------------------------------
*/
@@ -192,7 +192,7 @@
{
$path = rtrim($path, '\/').'/'.$system_path;
if (is_dir($path))
- {
+ {
$system_path = $path;
$found = TRUE;
break;
@@ -208,7 +208,7 @@
/*
* -------------------------------------------------------------------
- * Now that we know the path, set the main path constants
+ * Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
// The name of THIS file
@@ -284,4 +284,4 @@
CodeIgniter::instance()->run();
/* End of file index.php */
-/* Location: ./index.php */
+/* Location: ./index.php */
View
10 system/core/CodeIgniter.php
@@ -166,6 +166,7 @@ protected function __construct($config, $autoload, $basepath, $apppath)
/**
* Destructor
*
+ * @codeCoverageIgnore
* @return void
*/
public function __destruct()
@@ -328,6 +329,8 @@ public static function resolve_path($path)
* PHP < 5.3 get_called_class() is not available. For unit testing, this
* function can be overloaded in the mock class to return that class
* name for instantiation instead of CodeIgniter.
+ *
+ * @codeCoverageIgnore
*/
protected static function _get_class()
{
@@ -342,6 +345,7 @@ protected static function _get_class()
* before show_error can be called. It provides a mechanism
* for unit tests to override the exit calls.
*
+ * @codeCoverageIgnore
* @param int Status code
* @param string Exit message
* @return void
@@ -547,6 +551,7 @@ public function call_controller($class, $method, array $args = array(), $name =
* of the sequence in an extension class, and to unit test the operations
* in smaller chunks.
*
+ * @codeCoverageIgnore
* @return void
*/
public function run()
@@ -764,6 +769,7 @@ protected function _finalize()
* in place, and may not want this registered for all the other unit
* tests.
*
+ * @codeCoverageIgnore
* @return void
*/
protected function _catch_exceptions()
@@ -816,6 +822,10 @@ public function _exception_handler($severity, $message, $filepath, $line)
/**
* Global function to get CodeIgniter instance
*
+ * For unit testing, this should be overridden to return the
+ * CI_TestCase instance object instead
+ *
+ * @codeCoverageIgnore
* @return object CodeIgniter instance
*/
function &get_instance()
View
4 system/core/Common.php
@@ -120,7 +120,7 @@ function is_really_writable($file)
* Load class
*
* This function returns classes loaded in the core CodeIgniter object.
- * DEPRECATED - get object from CodeIgniter::instance() directly
+ * DEPRECATED - get object from CodeIgniter::instance() directly
* Core classes are loaded internally, and all others should call CI_Loader.
*
* @param string the class name being requested
@@ -152,7 +152,7 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
/**
* Checks if a class is loaded
*
- * DEPRECATED - check object with CodeIgniter::instance() directly
+ * DEPRECATED - check object with CodeIgniter::instance() directly
*
* @param string
* @return array
View
4 system/core/Config.php
@@ -73,11 +73,13 @@ class CI_Config {
* Sets the $config data from CodeIgniter::_core_config as a class variable.
* This is the contents of the primary config.php file with $assign_to_config
* overrides applied.
+ *
+ * @return void
*/
public function __construct()
{
// Take over core config
- $CI = get_instance();
+ $CI = get_instance(); // Use get_instance() for unit test override
$this->config = $CI->_core_config;
unset($CI->_core_config);
View
2  system/core/Controller.php
@@ -52,7 +52,7 @@ class CI_Controller {
*/
public function __construct()
{
- $this->CI = get_instance();
+ $this->CI = get_instance(); // Use get_instance() for unit test override
log_message('debug', 'Controller Class Initialized');
}
View
2  system/core/Exceptions.php
@@ -209,7 +209,7 @@ protected function _route_error($route, $template, $args = NULL)
}
// Check Router for an override
- $CI =& get_instance();
+ $CI =& get_instance(); // Use get_instance() for unit test override
if (isset($CI->router))
{
$stack = $CI->router->get_error_route($route);
View
2  system/core/Hooks.php
@@ -66,7 +66,7 @@ class CI_Hooks {
*/
public function __construct()
{
- $CI =& get_instance();
+ $CI =& get_instance(); // Use get_instance() for unit test override
log_message('debug', 'Hooks Class Initialized');
View
2  system/core/Input.php
@@ -101,7 +101,7 @@ public function __construct()
{
log_message('debug', 'Input Class Initialized');
- $CI =& get_instance();
+ $CI =& get_instance(); // Use get_instance() for unit test override
$this->security =& $CI->security;
$this->_allow_get_array = ($CI->config->item('allow_get_array') === TRUE);
View
2  system/core/Lang.php
@@ -85,7 +85,7 @@ public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE
if ($idiom === '')
{
- $CI = get_instance();
+ $CI = get_instance(); // Use get_instance() for unit test override
$cfg_lang = $CI->config->item('language');
$idiom = ( ! empty($cfg_lang)) ? $cfg_lang : 'english';
}
View
110 system/core/Loader.php
@@ -158,14 +158,14 @@ class CI_Loader {
public function __construct()
{
// Attach parent reference
- $this->CI =& get_instance();
+ $this->CI =& get_instance(); // Use get_instance() for unit test override
// Get initial buffering level
$this->_ci_ob_level = ob_get_level();
// Get library paths with autoloaded package paths
- $this->_ci_library_paths = (isset($this->CI->base_paths) && is_array($this->CI->base_paths)) ?
- $this->CI->base_paths : array(APPPATH, BASEPATH);
+ $this->_ci_library_paths = (isset($this->CI->base_paths) && is_array($this->CI->base_paths))
+ ? $this->CI->base_paths : array(APPPATH, BASEPATH);
// Get MVC paths with autoloaded package paths
// Apply cascade default to each one
@@ -187,7 +187,7 @@ public function __construct()
if ($paths)
{
// Validate each path and add to list
- foreach ( (array) $paths as $path)
+ foreach ((array) $paths as $path)
{
// Groom and resolve path against includes
// (get root object class for unit test override)
@@ -222,8 +222,8 @@ public function __construct()
*
* It is mainly used in the form_helper -> _get_validation_object()
*
- * @param string class being checked for
- * @return mixed class object name on the CI SuperObject or FALSE
+ * @param string Class being checked for
+ * @return mixed Class object name on the CI SuperObject or FALSE
*/
public function is_loaded($class)
{
@@ -238,9 +238,9 @@ public function is_loaded($class)
* This function lets users load and instantiate classes.
* It is designed to be called from a user's app controllers.
*
- * @param string the name of the class
- * @param mixed the optional parameters
- * @param string an optional object name
+ * @param string Class name
+ * @param mixed Optional parameters
+ * @param string Optional object name
* @return void
*/
public function library($library = '', $params = NULL, $object_name = NULL)
@@ -402,9 +402,9 @@ public function controller_output(&$out, $route, $name = NULL, $call = TRUE)
*
* This function lets users load and instantiate models.
*
- * @param string the name of the class
- * @param string name for the model
- * @param bool database connection
+ * @param string Class name
+ * @param string Optional object name
+ * @param bool Database connection flag
* @return void
*/
public function model($model, $name = '', $db_conn = FALSE)
@@ -521,10 +521,10 @@ public function model($model, $name = '', $db_conn = FALSE)
/**
* Database Loader
*
- * @param string the DB credentials
- * @param bool whether to return the DB object
- * @param bool whether to enable query builder (this allows us to override the config setting)
- * @return object
+ * @param string DB credentials
+ * @param bool Whether to return the DB object
+ * @param bool Whether to enable query builder (this allows us to override the config setting)
+ * @return object DB object
*/
public function database($params = '', $return = FALSE, $query_builder = NULL)
{
@@ -554,7 +554,7 @@ public function database($params = '', $return = FALSE, $query_builder = NULL)
/**
* Load the Utilities Class
*
- * @return string
+ * @return void
*/
public function dbutil()
{
@@ -580,7 +580,7 @@ public function dbutil()
/**
* Load the Database Forge Class
*
- * @return string
+ * @return void
*/
public function dbforge()
{
@@ -610,10 +610,10 @@ public function dbforge()
* some cases it's advantageous to be able to return data so that
* a developer can process it in some way.
*
- * @param string
- * @param array
- * @param bool
- * @return void
+ * @param string View name
+ * @param array Optional vars
+ * @param bool Return output flag
+ * @return mixed Output string if requested, otherwise void
*/
public function view($view, $vars = array(), $return = FALSE)
{
@@ -631,9 +631,9 @@ public function view($view, $vars = array(), $return = FALSE)
*
* This is a generic file loader
*
- * @param string
- * @param bool
- * @return string
+ * @param string File path
+ * @param bool Return output flag
+ * @return mixed Output string if requested, otherwise void
*/
public function file($path, $return = FALSE)
{
@@ -651,8 +651,8 @@ public function file($path, $return = FALSE)
* Once variables are set they become available within
* the controller class and its "view" files.
*
- * @param array
- * @param string
+ * @param mixed Variable name or array of vars
+ * @param string Variable value
* @return void
*/
public function vars($vars = array(), $val = '')
@@ -680,8 +680,8 @@ public function vars($vars = array(), $val = '')
*
* Check if a variable is set and retrieve it.
*
- * @param array
- * @return void
+ * @param string Variable name
+ * @return mixed Variable value on success, otherwise NULL
*/
public function get_var($key)
{
@@ -695,7 +695,7 @@ public function get_var($key)
*
* Retrieve all loaded variables
*
- * @return array
+ * @return array All cached variables
*/
public function get_vars()
{
@@ -709,7 +709,7 @@ public function get_vars()
*
* This function loads the specified helper file.
*
- * @param mixed
+ * @param mixed Helper name or array of names
* @return void
*/
public function helper($helpers = array())
@@ -754,7 +754,7 @@ public function helper($helpers = array())
* This is simply an alias to the above function in case the
* user has written the plural form of this function.
*
- * @param array
+ * @param mixed Helper name or array of names
* @return void
*/
public function helpers($helpers = array())
@@ -767,8 +767,8 @@ public function helpers($helpers = array())
/**
* Loads a language file
*
- * @param array
- * @param string
+ * @param mixed File name or array of names
+ * @param string Optional language
* @return void
*/
public function language($file = array(), $lang = '')
@@ -789,9 +789,9 @@ public function language($file = array(), $lang = '')
/**
* Loads a config file
*
- * @param string
- * @param bool
- * @param bool
+ * @param string File name
+ * @param bool Sections flag
+ * @param bool Fail gracefully flag
* @return void
*/
public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
@@ -806,9 +806,9 @@ public function config($file = '', $use_sections = FALSE, $fail_gracefully = FAL
*
* Loads a driver library
*
- * @param mixed the name of the class or array of classes
- * @param mixed the optional parameters
- * @param string an optional object name
+ * @param mixed Class name or array of classes
+ * @param mixed Optional parameters
+ * @param string Optional object name
* @return void
*/
public function driver($library = '', $params = NULL, $object_name = NULL)
@@ -845,8 +845,8 @@ public function driver($library = '', $params = NULL, $object_name = NULL)
*
* Prepends a parent path to the library, mvc, and config path arrays
*
- * @param string path
- * @param bool view cascade flag
+ * @param string Path
+ * @param bool View cascade flag
* @return void
*/
public function add_package_path($path, $view_cascade = TRUE)
@@ -871,8 +871,8 @@ public function add_package_path($path, $view_cascade = TRUE)
*
* Return a list of all package paths, by default it will ignore $this->_ci_base_path.
*
- * @param boolean include base path flag
- * @return void
+ * @param bool Include base path flag
+ * @return array Package paths
*/
public function get_package_paths($include_base = FALSE)
{
@@ -887,8 +887,8 @@ public function get_package_paths($include_base = FALSE)
* Remove a path from the library, mvc, and config path arrays if it exists
* If no path is provided, the most recently added path is removed.
*
- * @param string path
- * @param boolean remove from config path flag
+ * @param string Path
+ * @param bool Remove from config path flag
* @return void
*/
public function remove_package_path($path = '', $remove_config_path = TRUE)
@@ -1016,8 +1016,8 @@ protected function _ci_include($name, $dir)
* Variables are prefixed with _ci_ to avoid symbol collision with
* variables made available to view files
*
- * @param array
- * @return void
+ * @param array Load parameters
+ * @return mixed Output if requested, otherwise void
*/
protected function _ci_load($_ci_data)
{
@@ -1190,9 +1190,9 @@ protected function _ci_load($_ci_data)
*
* This function loads the requested class.
*
- * @param string the item that is being loaded
- * @param mixed any additional parameters
- * @param string an optional object name
+ * @param string Class name
+ * @param mixed Optional parameters
+ * @param string Optional object name
* @return void
*/
protected function _ci_load_class($class, $params = NULL, $object_name = NULL)
@@ -1422,7 +1422,7 @@ protected function _ci_init_class($class, $prefix = '', $config = NULL, $object_
* libraries, and helpers to be loaded automatically.
*
* This function is public, as it's called from CodeIgniter.php.
- * However, there is no reason you should ever need to use it.
+ * However, there is no reason you should ever need to call it directly.
*
* @return void
*/
@@ -1473,7 +1473,7 @@ public function _ci_autoloader()
{
// We have to "manually" feed multiples to controller(), since an array
// is treated as a router stack instead of more than one controller
- foreach ((array)$autoload['controller'] as $uri)
+ foreach ((array) $autoload['controller'] as $uri)
{
$this->controller($uri);
}
@@ -1493,8 +1493,8 @@ public function _ci_autoloader()
*
* Takes an object as input and converts the class variables to array key/vals
*
- * @param object
- * @return array
+ * @param object Input object
+ * @return array Array conversion
*/
protected function _ci_object_to_array($object)
{
View
4 system/core/Log.php
@@ -95,8 +95,8 @@ class CI_Log {
*/
public function configure($config)
{
- $this->_log_path = (isset($config['log_path']) && ! empty($config['log_path'])) ?
- $config['log_path'] : APPPATH.'logs/';
+ $this->_log_path = (isset($config['log_path']) && ! empty($config['log_path']))
+ ? $config['log_path'] : APPPATH.'logs/';
if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path))
{
View
70 system/core/Output.php
@@ -46,70 +46,70 @@ class CI_Output {
protected $CI;
/**
- * Current output string
+ * Current output stack
*
* Protected to prevent corruption
* Accessible as string via __get for backward compatibility
*
* @var array
*/
- protected $final_output = array('');
+ protected $final_output = array('');
/**
* Cache expiration time
*
* @var int
*/
- public $cache_expiration = 0;
+ public $cache_expiration = 0;
/**
* List of server headers
*
* @var array
*/
- public $headers = array();
+ public $headers = array();
/**
* List of mime types
*
* @var array
*/
- public $mimes = NULL;
+ public $mimes = NULL;
/**
* Mime-type for the current page
*
* @var string
*/
- protected $mime_type = 'text/html';
+ protected $mime_type = 'text/html';
/**
* Determines whether profiler is enabled
*
* @var bool
*/
- public $enable_profiler = FALSE;
+ public $enable_profiler = FALSE;
/**
* Determines if output compression is enabled
*
* @var bool
*/
- protected $_zlib_oc = FALSE;
+ protected $_zlib_oc = FALSE;
/**
* List of profiler sections
*
* @var array
*/
- protected $_profiler_sections = array();
+ protected $_profiler_sections = array();
/**
* Whether or not to parse variables like {elapsed_time} and {memory_usage}
*
* @var bool
*/
- public $parse_exec_vars = TRUE;
+ public $parse_exec_vars = TRUE;
/**
* Set up Output class
@@ -119,7 +119,7 @@ class CI_Output {
public function __construct()
{
// Get parent reference
- $this->CI =& get_instance();
+ $this->CI =& get_instance(); // Use get_instance() for unit test override
$this->_zlib_oc = (bool) @ini_get('zlib.output_compression');
@@ -134,7 +134,7 @@ public function __construct()
* Returns the current output string
*
* @param mixed Optional level (FALSE = current, TRUE = all)
- * @return string
+ * @return string Output
*/
public function get_output($level = FALSE)
{
@@ -220,7 +220,6 @@ protected function _get_index($level)
*
* Pushes a new output buffer onto the stack
*
- * @access public
* @param string Optional initial buffer contents
* @return int New stack depth
*/
@@ -238,7 +237,6 @@ public function stack_push($output = '')
*
* Returns number of buffer levels in final output stack
*
- * @access public
* @return int Stack depth
*/
public function stack_level()
@@ -255,8 +253,7 @@ public function stack_level()
* Pops current output buffer off the stack and returns it
* Returns bottom buffer contents (without pop) if only one exists
*
- * @access public
- * @return string
+ * @return string Output
*/
public function stack_pop()
{
@@ -282,8 +279,8 @@ public function stack_pop()
* Note: If a file is cached, headers will not be sent. We need to figure out
* how to permit header data to be saved with the cache data...
*
- * @param string
- * @param bool
+ * @param string Header text
+ * @param bool Replace previous flag
* @return void
*/
public function set_header($header, $replace = TRUE)
@@ -306,7 +303,7 @@ public function set_header($header, $replace = TRUE)
/**
* Set Content Type Header
*
- * @param string extension of the file we're outputting
+ * @param string Extension of the file we're outputting
* @return void
*/
public function set_content_type($mime_type, $charset = NULL)
@@ -374,8 +371,8 @@ public function get_content_type()
* Set HTTP Status Header
* moved to Common procedural functions in 1.7.2
*
- * @param int the status code
- * @param string
+ * @param int Status code
+ * @param string Header text
* @return void
*/
public function set_status_header($code = 200, $text = '')
@@ -389,7 +386,7 @@ public function set_status_header($code = 200, $text = '')
/**
* Enable/disable Profiler
*
- * @param bool
+ * @param bool Enable/disable flag
* @return void
*/
public function enable_profiler($val = TRUE)
@@ -405,7 +402,7 @@ public function enable_profiler($val = TRUE)
*
* Allows override of default / config settings for Profiler section display
*
- * @param array
+ * @param array Section overrides
* @return void
*/
public function set_profiler_sections($sections)
@@ -429,7 +426,7 @@ public function set_profiler_sections($sections)
/**
* Set Cache
*
- * @param int
+ * @param int Expiration in seconds
* @return void
*/
public function cache($time)
@@ -447,9 +444,9 @@ public function cache($time)
*
* $this->final_output
*
- * This function sends the finalized output data to the browser along
- * with any server headers and profile data. It also stops the
- * benchmark timer so the page rendering speed and memory usage can be shown.
+ * This function sends any server headers; inserts the page rendering speed,
+ * memory usage, and any profile data; and sends the finalized output data
+ * to the browser (or CI_Controller::_output).
*
* @param string
* @return mixed
@@ -486,13 +483,10 @@ public function _display($output = '')
// Parse out the elapsed time and memory usage,
// then swap the pseudo-variables with the data
-
$elapsed = $this->CI->benchmark->elapsed_time('total_execution_time_start', 'total_execution_time_end');
-
if ($this->parse_exec_vars === TRUE)
{
$memory = round(memory_get_usage() / 1024 / 1024, 2).'MB';
-
$output = str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsed, $memory), $output);
}
@@ -571,7 +565,7 @@ public function _display($output = '')
/**
* Write a Cache File
*
- * @param string
+ * @param string Page output
* @return void
*/
public function _write_cache($output)
@@ -623,7 +617,7 @@ public function _write_cache($output)
/**
* Update/serve a cached file
*
- * @return bool
+ * @return bool TRUE on success, otherwise FALSE
*/
public function _display_cache()
{
@@ -633,7 +627,7 @@ public function _display_cache()
$cache_path = APPPATH.'cache/';
}
- // Build the file path. The file name is an MD5 hash of the full this->CI->uri
+ // Build the file path. The file name is an MD5 hash of the full URI
$uri = $this->CI->config->item('base_url').$this->CI->config->item('index_page').$this->CI->uri->uri_string;
$filepath = $cache_path.md5($uri);
@@ -682,8 +676,8 @@ public function _display_cache()
* Set the HTTP headers to match the server-side file cache settings
* in order to reduce bandwidth.
*
- * @param int timestamp of when the page was last modified
- * @param int timestamp of when should the requested page expire from cache
+ * @param int Timestamp of when the page was last modified
+ * @param int Timestamp of when should the requested page expire from cache
* @return void
*/
public function set_cache_header($last_modified, $expiration)
@@ -709,9 +703,9 @@ public function set_cache_header($last_modified, $expiration)
/**
* Reduce excessive size of HTML content.
*
- * @param string
- * @param string
- * @return string
+ * @param string Output
+ * @param string Content type
+ * @return string Minified output
*/
public function minify($output, $type = 'text/html')
{
View
38 system/core/Router.php
@@ -48,21 +48,21 @@ class CI_Router {
/**
* List of routes
*
- * @var array
+ * @var array
*/
- public $routes = array();
+ public $routes = array();
/**
* Stack of route data
*
- * @var array
+ * @var array
*/
protected $route_stack;
/**
* Default controller (and method if specific)
*
- * @var string
+ * @var string
*/
protected $default_controller;
@@ -84,7 +84,7 @@ class CI_Router {
*/
public function __construct()
{
- $this->CI =& get_instance();
+ $this->CI =& get_instance(); // Use get_instance() for unit test override
$this->route_stack = array('', '', '', '');
log_message('debug', 'Router Class Initialized');
}
@@ -111,7 +111,7 @@ public function _set_routing()
// Set the default controller so we can display it in the event
// the URI doesn't correlate to a valid controller.
$this->default_controller = empty($this->routes['default_controller'])
- ? FALSE : strtolower($this->routes['default_controller']);
+ ? FALSE : strtolower($this->routes['default_controller']);
// Are query strings enabled in the config file? Normally CI doesn't utilize query strings
// since URI segments are more search-engine friendly, but they can optionally be used.
@@ -203,8 +203,7 @@ protected function _set_request(array $segments)
* ... // Any remaining segments
* );
*
- * @access public
- * @param array route segments
+ * @param mixed URI string or route segments
* @return mixed FALSE if route doesn't exist, otherwise array of 4+ segments
*/
public function validate_route($route)
@@ -422,7 +421,7 @@ protected function _parse_routes(array $segments)
/**
* Set the class name
*
- * @param string
+ * @param string Class name
* @return void
*/
public function set_class($class)
@@ -435,7 +434,7 @@ public function set_class($class)
/**
* Fetch the current class
*
- * @return string
+ * @return string Class name
*/
public function fetch_class()
{
@@ -447,7 +446,7 @@ public function fetch_class()
/**
* Set the method name
*
- * @param string
+ * @param string Method name
* @return void
*/
public function set_method($method)
@@ -460,7 +459,7 @@ public function set_method($method)
/**
* Fetch the current method
*
- * @return string
+ * @return string Method name
*/
public function fetch_method()
{
@@ -473,7 +472,7 @@ public function fetch_method()
/**
* Set the directory name
*
- * @param string
+ * @param string Sub-directory name
* @return void
*/
public function set_directory($dir)
@@ -486,7 +485,7 @@ public function set_directory($dir)
/**
* Fetch the sub-directory (if any) that contains the requested controller class
*
- * @return string
+ * @return string Sub-directory name
*/
public function fetch_directory()
{
@@ -498,7 +497,7 @@ public function fetch_directory()
/**
* Set the package path
*
- * @param string
+ * @param string Package path
* @return void
*/
public function set_path($path)
@@ -511,7 +510,7 @@ public function set_path($path)
/**
* Fetch the current package path
*
- * @return string
+ * @return string Package path
*/
public function fetch_path()
{
@@ -523,7 +522,7 @@ public function fetch_path()
/**
* Fetch the current route stack
*
- * @return array
+ * @return array Route stack
*/
public function fetch_route()
{
@@ -557,7 +556,7 @@ public function get_error_route($route)
/**
* Set the controller overrides
*
- * @param array
+ * @param array Routing config overrides
* @return void
*/
public function _set_overrides($routing)
@@ -594,8 +593,7 @@ public function _set_overrides($routing)
/**
* Get segments of default controller
*
- * @access protected
- * @return array array of segments
+ * @return array Default controller segments
*/
protected function _default_segments()
{
View
6 system/core/Security.php
@@ -111,7 +111,7 @@ class CI_Security {
public function __construct()
{
// Is CSRF protection enabled?
- $CI = get_instance();
+ $CI = get_instance(); // Use get_instance() for unit test override
if ($CI->config->item('csrf_protection') === TRUE)
{
// CSRF config
@@ -152,7 +152,7 @@ public function csrf_verify()
}
// Check if URI has been whitelisted from CSRF checks
- $CI = get_instance();
+ $CI = get_instance(); // Use get_instance() for unit test override
if ($exclude_uris = $CI->config->item('csrf_exclude_uris'))
{
if (in_array($CI->uri->uri_string(), $exclude_uris))
@@ -196,7 +196,7 @@ public function csrf_verify()
*/
public function csrf_set_cookie()
{
- $CI = get_instance();
+ $CI = get_instance(); // Use get_instance() for unit test override
$expire = time() + $this->_csrf_expire;
$secure_cookie = (bool) $CI->config->item('cookie_secure');
View
2  system/core/URI.php
@@ -78,7 +78,7 @@ class CI_URI {
*/
public function __construct()
{
- $this->config = get_instance()->config;
+ $this->config = get_instance()->config; // Use get_instance() for unit test override
log_message('debug', 'URI Class Initialized');
}
View
2  system/core/Utf8.php
@@ -49,7 +49,7 @@ public function __construct()
{
log_message('debug', 'Utf8 Class Initialized');
- $CI =& get_instance();
+ $CI =& get_instance(); // Use get_instance() for unit test override
if (
@preg_match('/./u', 'é') === 1 // PCRE must support UTF-8
Please sign in to comment.
Something went wrong with that request. Please try again.