@@ -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 | } |
@@ -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 | { |
@@ -200,16 +200,14 @@ discard block |
||
| 200 | 200 | if (empty($library)) |
| 201 | 201 | { |
| 202 | 202 | return $this; |
| 203 | - } |
|
| 204 | - elseif (is_array($library)) |
|
| 203 | + } elseif (is_array($library)) |
|
| 205 | 204 | { |
| 206 | 205 | foreach ($library as $key => $value) |
| 207 | 206 | { |
| 208 | 207 | if (is_int($key)) |
| 209 | 208 | { |
| 210 | 209 | $this->library($value, $params); |
| 211 | - } |
|
| 212 | - else |
|
| 210 | + } else |
|
| 213 | 211 | { |
| 214 | 212 | $this->library($key, $params, $value); |
| 215 | 213 | } |
@@ -246,8 +244,7 @@ discard block |
||
| 246 | 244 | if (empty($model)) |
| 247 | 245 | { |
| 248 | 246 | return $this; |
| 249 | - } |
|
| 250 | - elseif (is_array($model)) |
|
| 247 | + } elseif (is_array($model)) |
|
| 251 | 248 | { |
| 252 | 249 | foreach ($model as $key => $value) |
| 253 | 250 | { |
@@ -313,8 +310,7 @@ discard block |
||
| 313 | 310 | { |
| 314 | 311 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
| 315 | 312 | } |
| 316 | - } |
|
| 317 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 313 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 318 | 314 | { |
| 319 | 315 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
| 320 | 316 | } |
@@ -471,8 +467,7 @@ discard block |
||
| 471 | 467 | require_once($driver_path); |
| 472 | 468 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
| 473 | 469 | } |
| 474 | - } |
|
| 475 | - else |
|
| 470 | + } else |
|
| 476 | 471 | { |
| 477 | 472 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
| 478 | 473 | } |
@@ -761,16 +756,14 @@ discard block |
||
| 761 | 756 | if (is_int($key)) |
| 762 | 757 | { |
| 763 | 758 | $this->driver($value, $params); |
| 764 | - } |
|
| 765 | - else |
|
| 759 | + } else |
|
| 766 | 760 | { |
| 767 | 761 | $this->driver($key, $params, $value); |
| 768 | 762 | } |
| 769 | 763 | } |
| 770 | 764 | |
| 771 | 765 | return $this; |
| 772 | - } |
|
| 773 | - elseif (empty($library)) |
|
| 766 | + } elseif (empty($library)) |
|
| 774 | 767 | { |
| 775 | 768 | return FALSE; |
| 776 | 769 | } |
@@ -869,8 +862,7 @@ discard block |
||
| 869 | 862 | array_shift($this->_ci_helper_paths); |
| 870 | 863 | array_shift($this->_ci_view_paths); |
| 871 | 864 | array_pop($config->_config_paths); |
| 872 | - } |
|
| 873 | - else |
|
| 865 | + } else |
|
| 874 | 866 | { |
| 875 | 867 | $path = rtrim($path, '/').'/'; |
| 876 | 868 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -934,8 +926,7 @@ discard block |
||
| 934 | 926 | { |
| 935 | 927 | $_ci_x = explode('/', $_ci_path); |
| 936 | 928 | $_ci_file = end($_ci_x); |
| 937 | - } |
|
| 938 | - else |
|
| 929 | + } else |
|
| 939 | 930 | { |
| 940 | 931 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 941 | 932 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -1002,8 +993,7 @@ discard block |
||
| 1002 | 993 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
| 1003 | 994 | { |
| 1004 | 995 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 1005 | - } |
|
| 1006 | - else |
|
| 996 | + } else |
|
| 1007 | 997 | { |
| 1008 | 998 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 1009 | 999 | } |
@@ -1030,8 +1020,7 @@ discard block |
||
| 1030 | 1020 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 1031 | 1021 | { |
| 1032 | 1022 | ob_end_flush(); |
| 1033 | - } |
|
| 1034 | - else |
|
| 1023 | + } else |
|
| 1035 | 1024 | { |
| 1036 | 1025 | $_ci_CI->output->append_output(ob_get_contents()); |
| 1037 | 1026 | @ob_end_clean(); |
@@ -1071,8 +1060,7 @@ discard block |
||
| 1071 | 1060 | |
| 1072 | 1061 | // Get the filename from the path |
| 1073 | 1062 | $class = substr($class, $last_slash); |
| 1074 | - } |
|
| 1075 | - else |
|
| 1063 | + } else |
|
| 1076 | 1064 | { |
| 1077 | 1065 | $subdir = ''; |
| 1078 | 1066 | } |
@@ -1210,8 +1198,7 @@ discard block |
||
| 1210 | 1198 | if (file_exists(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
| 1211 | 1199 | { |
| 1212 | 1200 | include_once(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
| 1213 | - } |
|
| 1214 | - else |
|
| 1201 | + } else |
|
| 1215 | 1202 | { |
| 1216 | 1203 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
| 1217 | 1204 | } |
@@ -1227,8 +1214,7 @@ discard block |
||
| 1227 | 1214 | { |
| 1228 | 1215 | $prefix = config_item('subclass_prefix'); |
| 1229 | 1216 | break; |
| 1230 | - } |
|
| 1231 | - else |
|
| 1217 | + } else |
|
| 1232 | 1218 | { |
| 1233 | 1219 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
| 1234 | 1220 | } |
@@ -1277,8 +1263,7 @@ discard block |
||
| 1277 | 1263 | { |
| 1278 | 1264 | include($path.'config/'.strtolower($class).'.php'); |
| 1279 | 1265 | $found = TRUE; |
| 1280 | - } |
|
| 1281 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1266 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1282 | 1267 | { |
| 1283 | 1268 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
| 1284 | 1269 | $found = TRUE; |
@@ -1288,8 +1273,7 @@ discard block |
||
| 1288 | 1273 | { |
| 1289 | 1274 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1290 | 1275 | $found = TRUE; |
| 1291 | - } |
|
| 1292 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1276 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1293 | 1277 | { |
| 1294 | 1278 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1295 | 1279 | $found = TRUE; |
@@ -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 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @link https://github.com/kenjis/ci-phpunit-test |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -require __DIR__ . '/Installer.php'; |
|
| 11 | +require __DIR__.'/Installer.php'; |
|
| 12 | 12 | |
| 13 | 13 | $installer = new Installer(); |
| 14 | 14 | $installer->update(); |
@@ -15,17 +15,17 @@ |
||
| 15 | 15 | |
| 16 | 16 | // php update.php -s |
| 17 | 17 | if (isset($argv[1]) && $argv[1] === '-s') { |
| 18 | - $silent = true; |
|
| 18 | + $silent = true; |
|
| 19 | 19 | |
| 20 | - // php update.php -s app |
|
| 21 | - if (isset($argv[2]) && is_dir($argv[2])) { |
|
| 22 | - $app_dir = $argv[2]; |
|
| 23 | - } |
|
| 20 | + // php update.php -s app |
|
| 21 | + if (isset($argv[2]) && is_dir($argv[2])) { |
|
| 22 | + $app_dir = $argv[2]; |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // php update.php app |
| 27 | 27 | if (isset($argv[1]) && is_dir($argv[1])) { |
| 28 | - $app_dir = $argv[1]; |
|
| 28 | + $app_dir = $argv[1]; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $installer = new Installer($silent); |