@@ -10,8 +10,8 @@ |
||
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
| 12 | 12 | |
| 13 | -require __DIR__ . '/FunctionPatcher/NodeVisitor.php'; |
|
| 14 | -require __DIR__ . '/FunctionPatcher/Proxy.php'; |
|
| 13 | +require __DIR__.'/FunctionPatcher/NodeVisitor.php'; |
|
| 14 | +require __DIR__.'/FunctionPatcher/Proxy.php'; |
|
| 15 | 15 | |
| 16 | 16 | use LogicException; |
| 17 | 17 | |
@@ -173,13 +173,11 @@ |
||
| 173 | 173 | if (is_string($token)) |
| 174 | 174 | { |
| 175 | 175 | $new_source .= $token; |
| 176 | - } |
|
| 177 | - elseif ($i == $replacement['key']) |
|
| 176 | + } elseif ($i == $replacement['key']) |
|
| 178 | 177 | { |
| 179 | 178 | $new_source .= $replacement['value']; |
| 180 | 179 | $replacement = each(self::$replacement); |
| 181 | - } |
|
| 182 | - else |
|
| 180 | + } else |
|
| 183 | 181 | { |
| 184 | 182 | $new_source .= $token[1]; |
| 185 | 183 | } |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
| 12 | 12 | |
| 13 | -require __DIR__ . '/MethodPatcher/NodeVisitor.php'; |
|
| 14 | -require __DIR__ . '/MethodPatcher/PatchManager.php'; |
|
| 13 | +require __DIR__.'/MethodPatcher/NodeVisitor.php'; |
|
| 14 | +require __DIR__.'/MethodPatcher/PatchManager.php'; |
|
| 15 | 15 | |
| 16 | 16 | use LogicException; |
| 17 | 17 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | if ($start_method && $token === '{') |
| 57 | 57 | { |
| 58 | - $new_source .= '{ ' . self::CODE; |
|
| 58 | + $new_source .= '{ '.self::CODE; |
|
| 59 | 59 | $start_method = false; |
| 60 | 60 | $replacement = each(self::$replacement); |
| 61 | 61 | } |
@@ -58,13 +58,11 @@ |
||
| 58 | 58 | $new_source .= '{ ' . self::CODE; |
| 59 | 59 | $start_method = false; |
| 60 | 60 | $replacement = each(self::$replacement); |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $new_source .= $token; |
| 65 | 64 | } |
| 66 | - } |
|
| 67 | - else |
|
| 65 | + } else |
|
| 68 | 66 | { |
| 69 | 67 | $new_source .= $token[1]; |
| 70 | 68 | } |
@@ -66,16 +66,16 @@ |
||
| 66 | 66 | $called_method = 'n/a'; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $log_args = function () use ($params) { |
|
| 69 | + $log_args = function() use ($params) { |
|
| 70 | 70 | $output = ''; |
| 71 | 71 | foreach ($params as $arg) { |
| 72 | - $output .= var_export($arg, true) . ', '; |
|
| 72 | + $output .= var_export($arg, true).', '; |
|
| 73 | 73 | } |
| 74 | 74 | $output = rtrim($output, ', '); |
| 75 | 75 | return $output; |
| 76 | 76 | }; |
| 77 | 77 | MonkeyPatchManager::log( |
| 78 | - 'invoke_method: ' . $class.'::'.$method . '(' . $log_args() . ') on line ' . $line . ' in ' . $file . ' by ' . $called_method |
|
| 78 | + 'invoke_method: '.$class.'::'.$method.'('.$log_args().') on line '.$line.' in '.$file.' by '.$called_method |
|
| 79 | 79 | ); |
| 80 | 80 | // var_dump($trace); exit; |
| 81 | 81 | } |
@@ -56,12 +56,10 @@ discard block |
||
| 56 | 56 | if (isset($info['class_method'])) |
| 57 | 57 | { |
| 58 | 58 | $called_method = $info['class_method']; |
| 59 | - } |
|
| 60 | - elseif (isset($info['function'])) |
|
| 59 | + } elseif (isset($info['function'])) |
|
| 61 | 60 | { |
| 62 | 61 | $called_method = $info['function']; |
| 63 | - } |
|
| 64 | - else |
|
| 62 | + } else |
|
| 65 | 63 | { |
| 66 | 64 | $called_method = 'n/a'; |
| 67 | 65 | } |
@@ -88,8 +86,7 @@ discard block |
||
| 88 | 86 | ) |
| 89 | 87 | { |
| 90 | 88 | $patch = self::$patches[$class][$method]; |
| 91 | - } |
|
| 92 | - else |
|
| 89 | + } else |
|
| 93 | 90 | { |
| 94 | 91 | return __GO_TO_ORIG__; |
| 95 | 92 | } |
@@ -11,16 +11,16 @@ |
||
| 11 | 11 | // Autoloader for PHP-Parser |
| 12 | 12 | // Don't use `require`, because we must require it in CIPHPUnitTest::init() |
| 13 | 13 | // for providing autoloading when we don't use Monkey Patching |
| 14 | -require_once __DIR__ . '/third_party/PHP-Parser/lib/bootstrap.php'; |
|
| 14 | +require_once __DIR__.'/third_party/PHP-Parser/lib/bootstrap.php'; |
|
| 15 | 15 | |
| 16 | -require __DIR__ . '/IncludeStream.php'; |
|
| 17 | -require __DIR__ . '/PathChecker.php'; |
|
| 18 | -require __DIR__ . '/MonkeyPatchManager.php'; |
|
| 19 | -require __DIR__ . '/MonkeyPatch.php'; |
|
| 20 | -require __DIR__ . '/Cache.php'; |
|
| 21 | -require __DIR__ . '/InvocationVerifier.php'; |
|
| 16 | +require __DIR__.'/IncludeStream.php'; |
|
| 17 | +require __DIR__.'/PathChecker.php'; |
|
| 18 | +require __DIR__.'/MonkeyPatchManager.php'; |
|
| 19 | +require __DIR__.'/MonkeyPatch.php'; |
|
| 20 | +require __DIR__.'/Cache.php'; |
|
| 21 | +require __DIR__.'/InvocationVerifier.php'; |
|
| 22 | 22 | |
| 23 | -require __DIR__ . '/functions/exit__.php'; |
|
| 23 | +require __DIR__.'/functions/exit__.php'; |
|
| 24 | 24 | |
| 25 | 25 | const __GO_TO_ORIG__ = '__GO_TO_ORIG__'; |
| 26 | 26 | |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | |
| 19 | 19 | if ($class === null) |
| 20 | 20 | { |
| 21 | - $message = 'exit() called in ' . $method . '() function'; |
|
| 21 | + $message = 'exit() called in '.$method.'() function'; |
|
| 22 | 22 | } |
| 23 | 23 | else |
| 24 | 24 | { |
| 25 | - $message = 'exit() called in ' . $class . '::' . $method . '()'; |
|
| 25 | + $message = 'exit() called in '.$class.'::'.$method.'()'; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $exception_name = Kenjis\MonkeyPatch\MonkeyPatchManager::getExitExceptionClassname(); |
@@ -19,8 +19,7 @@ |
||
| 19 | 19 | if ($class === null) |
| 20 | 20 | { |
| 21 | 21 | $message = 'exit() called in ' . $method . '() function'; |
| 22 | - } |
|
| 23 | - else |
|
| 22 | + } else |
|
| 24 | 23 | { |
| 25 | 24 | $message = 'exit() called in ' . $class . '::' . $method . '()'; |
| 26 | 25 | } |
@@ -63,63 +63,63 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @var array |
| 65 | 65 | */ |
| 66 | - protected $_ci_view_paths = array(VIEWPATH => TRUE); |
|
| 66 | + protected $_ci_view_paths = array(VIEWPATH => TRUE); |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * List of paths to load libraries from |
| 70 | 70 | * |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - protected $_ci_library_paths = array(APPPATH, BASEPATH); |
|
| 73 | + protected $_ci_library_paths = array(APPPATH, BASEPATH); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * List of paths to load models from |
| 77 | 77 | * |
| 78 | 78 | * @var array |
| 79 | 79 | */ |
| 80 | - protected $_ci_model_paths = array(APPPATH); |
|
| 80 | + protected $_ci_model_paths = array(APPPATH); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * List of paths to load helpers from |
| 84 | 84 | * |
| 85 | 85 | * @var array |
| 86 | 86 | */ |
| 87 | - protected $_ci_helper_paths = array(APPPATH, BASEPATH); |
|
| 87 | + protected $_ci_helper_paths = array(APPPATH, BASEPATH); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * List of cached variables |
| 91 | 91 | * |
| 92 | 92 | * @var array |
| 93 | 93 | */ |
| 94 | - protected $_ci_cached_vars = array(); |
|
| 94 | + protected $_ci_cached_vars = array(); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * List of loaded classes |
| 98 | 98 | * |
| 99 | 99 | * @var array |
| 100 | 100 | */ |
| 101 | - protected $_ci_classes = array(); |
|
| 101 | + protected $_ci_classes = array(); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * List of loaded models |
| 105 | 105 | * |
| 106 | 106 | * @var array |
| 107 | 107 | */ |
| 108 | - protected $_ci_models = array(); |
|
| 108 | + protected $_ci_models = array(); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * List of loaded helpers |
| 112 | 112 | * |
| 113 | 113 | * @var array |
| 114 | 114 | */ |
| 115 | - protected $_ci_helpers = array(); |
|
| 115 | + protected $_ci_helpers = array(); |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * List of class name mappings |
| 119 | 119 | * |
| 120 | 120 | * @var array |
| 121 | 121 | */ |
| 122 | - protected $_ci_varmap = array( |
|
| 122 | + protected $_ci_varmap = array( |
|
| 123 | 123 | 'unit_test' => 'unit', |
| 124 | 124 | 'user_agent' => 'agent' |
| 125 | 125 | ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function __construct() |
| 137 | 137 | { |
| 138 | 138 | $this->_ci_ob_level = ob_get_level(); |
| 139 | - $this->_ci_classes =& is_loaded(); |
|
| 139 | + $this->_ci_classes = & is_loaded(); |
|
| 140 | 140 | |
| 141 | 141 | log_message('info', 'Loader Class Initialized'); |
| 142 | 142 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | return $this; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $CI =& get_instance(); |
|
| 274 | + $CI = & get_instance(); |
|
| 275 | 275 | if (isset($CI->$name)) |
| 276 | 276 | { |
| 277 | 277 | throw new RuntimeException('The model name you are loading is the name of a resource that is already being used: '.$name); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | public function database($params = '', $return = FALSE, $query_builder = NULL) |
| 343 | 343 | { |
| 344 | 344 | // Grab the super object |
| 345 | - $CI =& get_instance(); |
|
| 345 | + $CI = & get_instance(); |
|
| 346 | 346 | |
| 347 | 347 | // Do we even need to load the database class? |
| 348 | 348 | if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && ! empty($CI->db->conn_id)) |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $CI->db = ''; |
| 363 | 363 | |
| 364 | 364 | // Load the DB class |
| 365 | - $CI->db =& DB($params, $query_builder); |
|
| 365 | + $CI->db = & DB($params, $query_builder); |
|
| 366 | 366 | return $this; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -377,12 +377,12 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function dbutil($db = NULL, $return = FALSE) |
| 379 | 379 | { |
| 380 | - $CI =& get_instance(); |
|
| 380 | + $CI = & get_instance(); |
|
| 381 | 381 | |
| 382 | 382 | if ( ! is_object($db) OR ! ($db instanceof CI_DB)) |
| 383 | 383 | { |
| 384 | 384 | class_exists('CI_DB', FALSE) OR $this->database(); |
| 385 | - $db =& $CI->db; |
|
| 385 | + $db = & $CI->db; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | require_once(BASEPATH.'database/DB_utility.php'); |
@@ -409,11 +409,11 @@ discard block |
||
| 409 | 409 | */ |
| 410 | 410 | public function dbforge($db = NULL, $return = FALSE) |
| 411 | 411 | { |
| 412 | - $CI =& get_instance(); |
|
| 412 | + $CI = & get_instance(); |
|
| 413 | 413 | if ( ! is_object($db) OR ! ($db instanceof CI_DB)) |
| 414 | 414 | { |
| 415 | 415 | class_exists('CI_DB', FALSE) OR $this->database(); |
| 416 | - $db =& $CI->db; |
|
| 416 | + $db = & $CI->db; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | require_once(BASEPATH.'database/DB_forge.php'); |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; |
| 747 | 747 | |
| 748 | 748 | // Add config file path |
| 749 | - $config =& $this->_ci_get_component('config'); |
|
| 749 | + $config = & $this->_ci_get_component('config'); |
|
| 750 | 750 | $config->_config_paths[] = $path; |
| 751 | 751 | |
| 752 | 752 | return $this; |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | public function remove_package_path($path = '') |
| 783 | 783 | { |
| 784 | - $config =& $this->_ci_get_component('config'); |
|
| 784 | + $config = & $this->_ci_get_component('config'); |
|
| 785 | 785 | |
| 786 | 786 | if ($path === '') |
| 787 | 787 | { |
@@ -882,12 +882,12 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | // This allows anything loaded using $this->load (views, files, etc.) |
| 884 | 884 | // to become accessible from within the Controller and Model functions. |
| 885 | - $_ci_CI =& get_instance(); |
|
| 885 | + $_ci_CI = & get_instance(); |
|
| 886 | 886 | foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) |
| 887 | 887 | { |
| 888 | 888 | if ( ! isset($this->$_ci_key)) |
| 889 | 889 | { |
| 890 | - $this->$_ci_key =& $_ci_CI->$_ci_key; |
|
| 890 | + $this->$_ci_key = & $_ci_CI->$_ci_key; |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | // return a new instance of the object |
| 1027 | 1027 | if ($object_name !== NULL) |
| 1028 | 1028 | { |
| 1029 | - $CI =& get_instance(); |
|
| 1029 | + $CI = & get_instance(); |
|
| 1030 | 1030 | if ( ! isset($CI->$object_name)) |
| 1031 | 1031 | { |
| 1032 | 1032 | return $this->_ci_init_library($class, '', $params, $object_name); |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | // return a new instance of the object |
| 1090 | 1090 | if ($object_name !== NULL) |
| 1091 | 1091 | { |
| 1092 | - $CI =& get_instance(); |
|
| 1092 | + $CI = & get_instance(); |
|
| 1093 | 1093 | if ( ! isset($CI->$object_name)) |
| 1094 | 1094 | { |
| 1095 | 1095 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | // Don't overwrite existing properties |
| 1235 | - $CI =& get_instance(); |
|
| 1235 | + $CI = & get_instance(); |
|
| 1236 | 1236 | if (isset($CI->$object_name)) |
| 1237 | 1237 | { |
| 1238 | 1238 | if ($CI->$object_name instanceof $class_name) |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | */ |
| 1366 | 1366 | protected function &_ci_get_component($component) |
| 1367 | 1367 | { |
| 1368 | - $CI =& get_instance(); |
|
| 1368 | + $CI = & get_instance(); |
|
| 1369 | 1369 | return $CI->$component; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param string $library Library name |
| 186 | 186 | * @param array $params Optional parameters to pass to the library class constructor |
| 187 | 187 | * @param string $object_name An optional object name to assign to |
| 188 | - * @return object |
|
| 188 | + * @return CI_Loader |
|
| 189 | 189 | */ |
| 190 | 190 | public function library($library, $params = NULL, $object_name = NULL) |
| 191 | 191 | { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param string $model Model name |
| 230 | 230 | * @param string $name An optional object name to assign to |
| 231 | 231 | * @param bool $db_conn An optional database connection configuration to initialize |
| 232 | - * @return object |
|
| 232 | + * @return CI_Loader |
|
| 233 | 233 | * |
| 234 | 234 | * modified by ci-phpunit-test |
| 235 | 235 | */ |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | /** |
| 362 | 362 | * Database Loader |
| 363 | 363 | * |
| 364 | - * @param mixed $params Database configuration options |
|
| 364 | + * @param string|boolean $params Database configuration options |
|
| 365 | 365 | * @param bool $return Whether to return the database object |
| 366 | 366 | * @param bool $query_builder Whether to enable Query Builder |
| 367 | 367 | * (overrides the configuration setting) |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | * An associative array or object containing values |
| 518 | 518 | * to be set, or a value's name if string |
| 519 | 519 | * @param string $val Value to set, only used if $vars is a string |
| 520 | - * @return object |
|
| 520 | + * @return CI_Loader |
|
| 521 | 521 | */ |
| 522 | 522 | public function vars($vars, $val = '') |
| 523 | 523 | { |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | * Helper Loader |
| 590 | 590 | * |
| 591 | 591 | * @param string|string[] $helpers Helper name(s) |
| 592 | - * @return object |
|
| 592 | + * @return CI_Loader |
|
| 593 | 593 | */ |
| 594 | 594 | public function helper($helpers = array()) |
| 595 | 595 | { |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | * |
| 661 | 661 | * @uses CI_Loader::helper() |
| 662 | 662 | * @param string|string[] $helpers Helper name(s) |
| 663 | - * @return object |
|
| 663 | + * @return CI_Loader |
|
| 664 | 664 | */ |
| 665 | 665 | public function helpers($helpers = array()) |
| 666 | 666 | { |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | * |
| 677 | 677 | * @param string|string[] $files List of language file names to load |
| 678 | 678 | * @param string Language name |
| 679 | - * @return object |
|
| 679 | + * @return CI_Loader |
|
| 680 | 680 | */ |
| 681 | 681 | public function language($files, $lang = '') |
| 682 | 682 | { |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | * |
| 771 | 771 | * @param string $path Path to add |
| 772 | 772 | * @param bool $view_cascade (default: TRUE) |
| 773 | - * @return object |
|
| 773 | + * @return CI_Loader |
|
| 774 | 774 | */ |
| 775 | 775 | public function add_package_path($path, $view_cascade = TRUE) |
| 776 | 776 | { |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | * added path will be removed removed. |
| 815 | 815 | * |
| 816 | 816 | * @param string $path Path to remove |
| 817 | - * @return object |
|
| 817 | + * @return CI_Loader |
|
| 818 | 818 | */ |
| 819 | 819 | public function remove_package_path($path = '') |
| 820 | 820 | { |
@@ -192,16 +192,14 @@ discard block |
||
| 192 | 192 | if (empty($library)) |
| 193 | 193 | { |
| 194 | 194 | return $this; |
| 195 | - } |
|
| 196 | - elseif (is_array($library)) |
|
| 195 | + } elseif (is_array($library)) |
|
| 197 | 196 | { |
| 198 | 197 | foreach ($library as $key => $value) |
| 199 | 198 | { |
| 200 | 199 | if (is_int($key)) |
| 201 | 200 | { |
| 202 | 201 | $this->library($value, $params); |
| 203 | - } |
|
| 204 | - else |
|
| 202 | + } else |
|
| 205 | 203 | { |
| 206 | 204 | $this->library($key, $params, $value); |
| 207 | 205 | } |
@@ -238,8 +236,7 @@ discard block |
||
| 238 | 236 | if (empty($model)) |
| 239 | 237 | { |
| 240 | 238 | return $this; |
| 241 | - } |
|
| 242 | - elseif (is_array($model)) |
|
| 239 | + } elseif (is_array($model)) |
|
| 243 | 240 | { |
| 244 | 241 | foreach ($model as $key => $value) |
| 245 | 242 | { |
@@ -305,8 +302,7 @@ discard block |
||
| 305 | 302 | { |
| 306 | 303 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
| 307 | 304 | } |
| 308 | - } |
|
| 309 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 305 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 310 | 306 | { |
| 311 | 307 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
| 312 | 308 | } |
@@ -457,8 +453,7 @@ discard block |
||
| 457 | 453 | require_once($driver_path); |
| 458 | 454 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
| 459 | 455 | } |
| 460 | - } |
|
| 461 | - else |
|
| 456 | + } else |
|
| 462 | 457 | { |
| 463 | 458 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
| 464 | 459 | } |
@@ -725,16 +720,14 @@ discard block |
||
| 725 | 720 | if (is_int($key)) |
| 726 | 721 | { |
| 727 | 722 | $this->driver($value, $params); |
| 728 | - } |
|
| 729 | - else |
|
| 723 | + } else |
|
| 730 | 724 | { |
| 731 | 725 | $this->driver($key, $params, $value); |
| 732 | 726 | } |
| 733 | 727 | } |
| 734 | 728 | |
| 735 | 729 | return $this; |
| 736 | - } |
|
| 737 | - elseif (empty($library)) |
|
| 730 | + } elseif (empty($library)) |
|
| 738 | 731 | { |
| 739 | 732 | return FALSE; |
| 740 | 733 | } |
@@ -827,8 +820,7 @@ discard block |
||
| 827 | 820 | array_shift($this->_ci_helper_paths); |
| 828 | 821 | array_shift($this->_ci_view_paths); |
| 829 | 822 | array_pop($config->_config_paths); |
| 830 | - } |
|
| 831 | - else |
|
| 823 | + } else |
|
| 832 | 824 | { |
| 833 | 825 | $path = rtrim($path, '/').'/'; |
| 834 | 826 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -890,8 +882,7 @@ discard block |
||
| 890 | 882 | { |
| 891 | 883 | $_ci_x = explode('/', $_ci_path); |
| 892 | 884 | $_ci_file = end($_ci_x); |
| 893 | - } |
|
| 894 | - else |
|
| 885 | + } else |
|
| 895 | 886 | { |
| 896 | 887 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 897 | 888 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -969,8 +960,7 @@ discard block |
||
| 969 | 960 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
| 970 | 961 | { |
| 971 | 962 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 972 | - } |
|
| 973 | - else |
|
| 963 | + } else |
|
| 974 | 964 | { |
| 975 | 965 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 976 | 966 | } |
@@ -997,8 +987,7 @@ discard block |
||
| 997 | 987 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 998 | 988 | { |
| 999 | 989 | ob_end_flush(); |
| 1000 | - } |
|
| 1001 | - else |
|
| 990 | + } else |
|
| 1002 | 991 | { |
| 1003 | 992 | $_ci_CI->output->append_output(ob_get_contents()); |
| 1004 | 993 | @ob_end_clean(); |
@@ -1038,8 +1027,7 @@ discard block |
||
| 1038 | 1027 | |
| 1039 | 1028 | // Get the filename from the path |
| 1040 | 1029 | $class = substr($class, $last_slash); |
| 1041 | - } |
|
| 1042 | - else |
|
| 1030 | + } else |
|
| 1043 | 1031 | { |
| 1044 | 1032 | $subdir = ''; |
| 1045 | 1033 | } |
@@ -1177,8 +1165,7 @@ discard block |
||
| 1177 | 1165 | if (file_exists(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
| 1178 | 1166 | { |
| 1179 | 1167 | include_once(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
| 1180 | - } |
|
| 1181 | - else |
|
| 1168 | + } else |
|
| 1182 | 1169 | { |
| 1183 | 1170 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
| 1184 | 1171 | } |
@@ -1194,8 +1181,7 @@ discard block |
||
| 1194 | 1181 | { |
| 1195 | 1182 | $prefix = config_item('subclass_prefix'); |
| 1196 | 1183 | break; |
| 1197 | - } |
|
| 1198 | - else |
|
| 1184 | + } else |
|
| 1199 | 1185 | { |
| 1200 | 1186 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
| 1201 | 1187 | } |
@@ -1242,8 +1228,7 @@ discard block |
||
| 1242 | 1228 | { |
| 1243 | 1229 | include($path.'config/'.strtolower($class).'.php'); |
| 1244 | 1230 | $found = TRUE; |
| 1245 | - } |
|
| 1246 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1231 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1247 | 1232 | { |
| 1248 | 1233 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
| 1249 | 1234 | $found = TRUE; |
@@ -1253,8 +1238,7 @@ discard block |
||
| 1253 | 1238 | { |
| 1254 | 1239 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1255 | 1240 | $found = TRUE; |
| 1256 | - } |
|
| 1257 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1241 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1258 | 1242 | { |
| 1259 | 1243 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1260 | 1244 | $found = TRUE; |
@@ -1442,8 +1426,7 @@ discard block |
||
| 1442 | 1426 | if ( ! is_array($filename)) |
| 1443 | 1427 | { |
| 1444 | 1428 | return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); |
| 1445 | - } |
|
| 1446 | - else |
|
| 1429 | + } else |
|
| 1447 | 1430 | { |
| 1448 | 1431 | foreach ($filename as $key => $val) |
| 1449 | 1432 | { |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | ob_end_clean(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - throw new CIPHPUnitTestRedirectException('Redirect to ' . $uri, $code); |
|
| 108 | + throw new CIPHPUnitTestRedirectException('Redirect to '.$uri, $code); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -63,16 +63,14 @@ discard block |
||
| 63 | 63 | if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) |
| 64 | 64 | { |
| 65 | 65 | $method = 'refresh'; |
| 66 | - } |
|
| 67 | - elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 66 | + } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 68 | 67 | { |
| 69 | 68 | if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') |
| 70 | 69 | { |
| 71 | 70 | $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
| 72 | 71 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
| 73 | 72 | : 307; |
| 74 | - } |
|
| 75 | - else |
|
| 73 | + } else |
|
| 76 | 74 | { |
| 77 | 75 | $code = 302; |
| 78 | 76 | } |
@@ -97,8 +95,7 @@ discard block |
||
| 97 | 95 | if (ENVIRONMENT !== 'testing') |
| 98 | 96 | { |
| 99 | 97 | exit; |
| 100 | - } |
|
| 101 | - else |
|
| 98 | + } else |
|
| 102 | 99 | { |
| 103 | 100 | while (ob_get_level() > 1) |
| 104 | 101 | { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function test_APPPATH() |
| 26 | 26 | { |
| 27 | 27 | $actual = realpath(APPPATH); |
| 28 | - $expected = realpath(__DIR__ . '/../..'); |
|
| 28 | + $expected = realpath(__DIR__.'/../..'); |
|
| 29 | 29 | $this->assertEquals( |
| 30 | 30 | $expected, |
| 31 | 31 | $actual, |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | elseif (strpos($class, 'CI_DB') === 0) |
| 103 | 103 | { |
| 104 | 104 | $dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR; |
| 105 | - $file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
|
| 105 | + $file = $dir.str_replace(array('CI_DB', 'active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
|
| 106 | 106 | } |
| 107 | 107 | else |
| 108 | 108 | { |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | if (strpos($class, 'Mock_') === 0) |
| 64 | 64 | { |
| 65 | 65 | $class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class)); |
| 66 | - } |
|
| 67 | - elseif (strpos($class, 'CI_') === 0) |
|
| 66 | + } elseif (strpos($class, 'CI_') === 0) |
|
| 68 | 67 | { |
| 69 | 68 | $subclass = substr($class, 3); |
| 70 | 69 | |
@@ -72,39 +71,32 @@ discard block |
||
| 72 | 71 | { |
| 73 | 72 | $dir = SYSTEM_PATH.'core'.DIRECTORY_SEPARATOR; |
| 74 | 73 | $class = $subclass; |
| 75 | - } |
|
| 76 | - elseif (in_array($subclass, $ci_libraries)) |
|
| 74 | + } elseif (in_array($subclass, $ci_libraries)) |
|
| 77 | 75 | { |
| 78 | 76 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR; |
| 79 | 77 | $class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass; |
| 80 | - } |
|
| 81 | - elseif (in_array($subclass, $ci_drivers)) |
|
| 78 | + } elseif (in_array($subclass, $ci_drivers)) |
|
| 82 | 79 | { |
| 83 | 80 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$subclass.DIRECTORY_SEPARATOR; |
| 84 | 81 | $class = $subclass; |
| 85 | - } |
|
| 86 | - elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) { |
|
| 82 | + } elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) { |
|
| 87 | 83 | $dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$parent.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
| 88 | 84 | $class = $subclass; |
| 89 | - } |
|
| 90 | - elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4) |
|
| 85 | + } elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4) |
|
| 91 | 86 | { |
| 92 | 87 | $driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
| 93 | 88 | $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR.'subdrivers'.DIRECTORY_SEPARATOR; |
| 94 | 89 | $file = $dir.$m[1].'_'.$m[2].'_'.$m[3].'.php'; |
| 95 | - } |
|
| 96 | - elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3) |
|
| 90 | + } elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3) |
|
| 97 | 91 | { |
| 98 | 92 | $driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; |
| 99 | 93 | $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR; |
| 100 | 94 | $file = $dir.$m[1].'_'.$m[2].'.php'; |
| 101 | - } |
|
| 102 | - elseif (strpos($class, 'CI_DB') === 0) |
|
| 95 | + } elseif (strpos($class, 'CI_DB') === 0) |
|
| 103 | 96 | { |
| 104 | 97 | $dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR; |
| 105 | 98 | $file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
| 106 | - } |
|
| 107 | - else |
|
| 99 | + } else |
|
| 108 | 100 | { |
| 109 | 101 | $class = strtolower($class); |
| 110 | 102 | } |