@@ -250,6 +250,9 @@ |
||
| 250 | 250 | return $this->createAndCallController($class, $method, $params); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | + /** |
|
| 254 | + * @param string $hook |
|
| 255 | + */ |
|
| 253 | 256 | protected function callHook($hook) |
| 254 | 257 | { |
| 255 | 258 | if ($this->enableHooks) |
@@ -154,8 +154,7 @@ discard block |
||
| 154 | 154 | ); |
| 155 | 155 | $this->testCase->disableStrictErrorCheck(); |
| 156 | 156 | return $ret; |
| 157 | - } |
|
| 158 | - else |
|
| 157 | + } else |
|
| 159 | 158 | { |
| 160 | 159 | $ret = $this->requestUri($http_method, $argv, $params); |
| 161 | 160 | $this->testCase->disableStrictErrorCheck(); |
@@ -169,8 +168,7 @@ discard block |
||
| 169 | 168 | if ($e->getCode() === 0) |
| 170 | 169 | { |
| 171 | 170 | set_status_header(200); |
| 172 | - } |
|
| 173 | - else |
|
| 171 | + } else |
|
| 174 | 172 | { |
| 175 | 173 | set_status_header($e->getCode()); |
| 176 | 174 | } |
@@ -63,6 +63,9 @@ discard block |
||
| 63 | 63 | return self::$cache_dir; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + /** |
|
| 67 | + * @param string $path |
|
| 68 | + */ |
|
| 66 | 69 | public static function getSrcCacheFilePath($path) |
| 67 | 70 | { |
| 68 | 71 | $len = strlen(self::$project_root); |
@@ -158,6 +161,9 @@ discard block |
||
| 158 | 161 | ); |
| 159 | 162 | } |
| 160 | 163 | |
| 164 | + /** |
|
| 165 | + * @param string $filename |
|
| 166 | + */ |
|
| 161 | 167 | protected static function writeTmpConfFile($filename, array $list) |
| 162 | 168 | { |
| 163 | 169 | $contents = implode("\n", $list); |
@@ -194,6 +200,9 @@ discard block |
||
| 194 | 200 | ); |
| 195 | 201 | } |
| 196 | 202 | |
| 203 | + /** |
|
| 204 | + * @param string $filename |
|
| 205 | + */ |
|
| 197 | 206 | protected static function getTmpConfFile($filename) |
| 198 | 207 | { |
| 199 | 208 | if (is_readable(self::$$filename)) |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param string $function function name |
| 23 | 23 | * @param mixed $return_value return value |
| 24 | - * @param string $class_name class::method to apply this patch |
|
| 24 | + * @param string $class_method class::method to apply this patch |
|
| 25 | 25 | */ |
| 26 | 26 | public static function patchFunction($function, $return_value, $class_method = null) |
| 27 | 27 | { |
@@ -55,6 +55,9 @@ discard block |
||
| 55 | 55 | PatchManager::clear(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $class_method |
|
| 60 | + */ |
|
| 58 | 61 | protected static function getClassname($class_method) |
| 59 | 62 | { |
| 60 | 63 | if (strpos($class_method, '::') === false) |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | if (strpos($class_method, '::') === false) |
| 61 | 61 | { |
| 62 | 62 | return 'Kenjis\MonkeyPatch\Patcher\FunctionPatcher\Proxy'; |
| 63 | - } |
|
| 64 | - else |
|
| 63 | + } else |
|
| 65 | 64 | { |
| 66 | 65 | return 'Kenjis\MonkeyPatch\Patcher\MethodPatcher\PatchManager'; |
| 67 | 66 | } |
@@ -136,6 +136,11 @@ discard block |
||
| 136 | 136 | return $_is_loaded; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | +/** |
|
| 140 | + * @param boolean $return |
|
| 141 | + * |
|
| 142 | + * @return boolean |
|
| 143 | + */ |
|
| 139 | 144 | function is_cli($return = null) |
| 140 | 145 | { |
| 141 | 146 | static $_return = TRUE; |
@@ -148,6 +153,9 @@ discard block |
||
| 148 | 153 | return $_return; |
| 149 | 154 | } |
| 150 | 155 | |
| 156 | +/** |
|
| 157 | + * @param string $message |
|
| 158 | + */ |
|
| 151 | 159 | function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') |
| 152 | 160 | { |
| 153 | 161 | $status_code = abs($status_code); |
@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN |
| 161 | 161 | |
| 162 | 162 | $status_code = 500; |
| 163 | - } |
|
| 164 | - else |
|
| 163 | + } else |
|
| 165 | 164 | { |
| 166 | 165 | $exit_status = 1; // EXIT_ERROR |
| 167 | 166 | } |
@@ -256,8 +255,7 @@ discard block |
||
| 256 | 255 | if (isset($stati[$code])) |
| 257 | 256 | { |
| 258 | 257 | $text = $stati[$code]; |
| 259 | - } |
|
| 260 | - else |
|
| 258 | + } else |
|
| 261 | 259 | { |
| 262 | 260 | show_error('No status text available. Please check your status code number or supply your own message text.', 500); |
| 263 | 261 | } |
@@ -327,8 +325,7 @@ discard block |
||
| 327 | 325 | if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) |
| 328 | 326 | { |
| 329 | 327 | require($file_path); |
| 330 | - } |
|
| 331 | - elseif ( ! $found) |
|
| 328 | + } elseif ( ! $found) |
|
| 332 | 329 | { |
| 333 | 330 | set_status_header(503); |
| 334 | 331 | echo 'The configuration file does not exist.'; |
@@ -67,8 +67,7 @@ |
||
| 67 | 67 | if ($this->offsetExists($key)) |
| 68 | 68 | { |
| 69 | 69 | return $this->map[$key]; |
| 70 | - } |
|
| 71 | - else |
|
| 70 | + } else |
|
| 72 | 71 | { |
| 73 | 72 | return null; |
| 74 | 73 | } |
@@ -29,16 +29,14 @@ |
||
| 29 | 29 | if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php')) |
| 30 | 30 | { |
| 31 | 31 | $e404 = TRUE; |
| 32 | - } |
|
| 33 | - else |
|
| 32 | + } else |
|
| 34 | 33 | { |
| 35 | 34 | require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php'); |
| 36 | 35 | |
| 37 | 36 | if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method)) |
| 38 | 37 | { |
| 39 | 38 | $e404 = TRUE; |
| 40 | - } |
|
| 41 | - elseif (method_exists($class, '_remap')) |
|
| 39 | + } elseif (method_exists($class, '_remap')) |
|
| 42 | 40 | { |
| 43 | 41 | $params = array($method, array_slice($URI->rsegments, 2)); |
| 44 | 42 | $method = '_remap'; |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | $CI->db->close(); |
| 41 | 41 | $CI->db = null; |
| 42 | - } |
|
| 43 | - else |
|
| 42 | + } else |
|
| 44 | 43 | { |
| 45 | 44 | // Don't close if SQLite in-memory database |
| 46 | 45 | // If we close it, all tables and stored data will be gone |
@@ -31,12 +31,10 @@ discard block |
||
| 31 | 31 | if ($invoked === false) |
| 32 | 32 | { |
| 33 | 33 | $actual_times = 0; |
| 34 | - } |
|
| 35 | - elseif ($expected_params === null) |
|
| 34 | + } elseif ($expected_params === null) |
|
| 36 | 35 | { |
| 37 | 36 | $actual_times = count($invocations[$class_method]); |
| 38 | - } |
|
| 39 | - else |
|
| 37 | + } else |
|
| 40 | 38 | { |
| 41 | 39 | $count = 0; |
| 42 | 40 | foreach ($invocations[$class_method] as $actual_params) |
@@ -56,16 +54,14 @@ discard block |
||
| 56 | 54 | $actual_times, |
| 57 | 55 | $class_method . '() expected to be not invoked, but invoked ' . $actual_times . ' times.' |
| 58 | 56 | ); |
| 59 | - } |
|
| 60 | - elseif ($expected_times === '+') |
|
| 57 | + } elseif ($expected_times === '+') |
|
| 61 | 58 | { |
| 62 | 59 | PHPUnit_Framework_TestCase::assertGreaterThanOrEqual( |
| 63 | 60 | 1, |
| 64 | 61 | $actual_times, |
| 65 | 62 | $class_method . '() expected to be invoked at least one time, but invoked ' . $actual_times . ' times.' |
| 66 | 63 | ); |
| 67 | - } |
|
| 68 | - else |
|
| 64 | + } else |
|
| 69 | 65 | { |
| 70 | 66 | PHPUnit_Framework_TestCase::assertEquals( |
| 71 | 67 | $expected_times, |
@@ -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 | } |