@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | empty($config) OR $this->initialize($config, FALSE); |
| 295 | 295 | |
| 296 | - $this->_mimes =& get_mimes(); |
|
| 297 | - $this->_CI =& get_instance(); |
|
| 296 | + $this->_mimes = & get_mimes(); |
|
| 297 | + $this->_CI = & get_instance(); |
|
| 298 | 298 | |
| 299 | 299 | log_message('info', 'Upload Class Initialized'); |
| 300 | 300 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | else |
| 481 | 481 | { |
| 482 | 482 | // An extension was provided, let's have it! |
| 483 | - $this->file_ext = $this->get_extension($this->_file_name_override); |
|
| 483 | + $this->file_ext = $this->get_extension($this->_file_name_override); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | if ( ! $this->is_allowed_filetype(TRUE)) |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | // Convert the file size to kilobytes |
| 494 | 494 | if ($this->file_size > 0) |
| 495 | 495 | { |
| 496 | - $this->file_size = round($this->file_size/1024, 2); |
|
| 496 | + $this->file_size = round($this->file_size / 1024, 2); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | // Is the file size within the allowed maximum? |
@@ -818,10 +818,10 @@ discard block |
||
| 818 | 818 | { |
| 819 | 819 | $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); |
| 820 | 820 | |
| 821 | - $this->image_width = $D[0]; |
|
| 822 | - $this->image_height = $D[1]; |
|
| 823 | - $this->image_type = isset($types[$D[2]]) ? $types[$D[2]] : 'unknown'; |
|
| 824 | - $this->image_size_str = $D[3]; // string containing height and width |
|
| 821 | + $this->image_width = $D[0]; |
|
| 822 | + $this->image_height = $D[1]; |
|
| 823 | + $this->image_type = isset($types[$D[2]]) ? $types[$D[2]] : 'unknown'; |
|
| 824 | + $this->image_size_str = $D[3]; // string containing height and width |
|
| 825 | 825 | } |
| 826 | 826 | } |
| 827 | 827 | |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | $this->file_type = 'image/jpeg'; |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - $img_mimes = array('image/gif', 'image/jpeg', 'image/png'); |
|
| 872 | + $img_mimes = array('image/gif', 'image/jpeg', 'image/png'); |
|
| 873 | 873 | |
| 874 | 874 | return in_array($this->file_type, $img_mimes, TRUE); |
| 875 | 875 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | return FALSE; |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | - $this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/', $this->upload_path); |
|
| 1014 | + $this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/', $this->upload_path); |
|
| 1015 | 1015 | return TRUE; |
| 1016 | 1016 | } |
| 1017 | 1017 | |
@@ -1055,9 +1055,9 @@ discard block |
||
| 1055 | 1055 | $ext = ''; |
| 1056 | 1056 | if (strpos($filename, '.') !== FALSE) |
| 1057 | 1057 | { |
| 1058 | - $parts = explode('.', $filename); |
|
| 1059 | - $ext = '.'.array_pop($parts); |
|
| 1060 | - $filename = implode('.', $parts); |
|
| 1058 | + $parts = explode('.', $filename); |
|
| 1059 | + $ext = '.'.array_pop($parts); |
|
| 1060 | + $filename = implode('.', $parts); |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | return substr($filename, 0, ($length - strlen($ext))).$ext; |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | public function install($app = 'application') |
| 23 | 23 | { |
| 24 | 24 | $this->recursiveCopy( |
| 25 | - dirname(__FILE__) . '/application/tests', |
|
| 26 | - $app . '/' . static::TEST_FOLDER |
|
| 25 | + dirname(__FILE__).'/application/tests', |
|
| 26 | + $app.'/'.static::TEST_FOLDER |
|
| 27 | 27 | ); |
| 28 | 28 | $this->fixPath($app); |
| 29 | 29 | } |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | private function fixPath($app = 'application') |
| 35 | 35 | { |
| 36 | - $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
| 36 | + $file = $app.'/'.static::TEST_FOLDER.'/Bootstrap.php'; |
|
| 37 | 37 | $contents = file_get_contents($file); |
| 38 | 38 | |
| 39 | - if (! file_exists('system')) { |
|
| 39 | + if ( ! file_exists('system')) { |
|
| 40 | 40 | if (file_exists('vendor/codeigniter/framework/system')) { |
| 41 | 41 | $contents = str_replace( |
| 42 | 42 | '$system_path = \'../../system\';', |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if (! file_exists('index.php')) { |
|
| 51 | + if ( ! file_exists('index.php')) { |
|
| 52 | 52 | if (file_exists('public/index.php')) { |
| 53 | 53 | // CodeIgniter 3.0.6 and after |
| 54 | 54 | $contents = str_replace( |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
| 63 | 63 | $contents |
| 64 | 64 | ); |
| 65 | - } elseif (file_exists($app . '/public/index.php')) { |
|
| 65 | + } elseif (file_exists($app.'/public/index.php')) { |
|
| 66 | 66 | // CodeIgniter 3.0.6 and after |
| 67 | 67 | $contents = str_replace( |
| 68 | 68 | "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function update($app = 'application') |
| 94 | 94 | { |
| 95 | - $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
| 95 | + $target_dir = $app.'/'.static::TEST_FOLDER.'/_ci_phpunit_test'; |
|
| 96 | 96 | $this->recursiveUnlink($target_dir); |
| 97 | 97 | $this->recursiveCopy( |
| 98 | - dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
| 98 | + dirname(__FILE__).'/application/tests/_ci_phpunit_test', |
|
| 99 | 99 | $target_dir |
| 100 | 100 | ); |
| 101 | 101 | } |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | foreach ($iterator as $file) { |
| 119 | 119 | if ($file->isDir()) { |
| 120 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
| 120 | + @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
| 121 | 121 | } else { |
| 122 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
| 122 | + $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
| 123 | 123 | if ($success) { |
| 124 | - if (! $this->silent) { |
|
| 125 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
| 124 | + if ( ! $this->silent) { |
|
| 125 | + echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | reset_config(); |
| 33 | 33 | |
| 34 | 34 | // Close db connection |
| 35 | - $CI =& get_instance(); |
|
| 35 | + $CI = & get_instance(); |
|
| 36 | 36 | if (isset($CI->db)) |
| 37 | 37 | { |
| 38 | 38 | if ( |
@@ -52,25 +52,25 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Load core classes |
| 55 | - $BM =& load_class('Benchmark', 'core'); |
|
| 55 | + $BM = & load_class('Benchmark', 'core'); |
|
| 56 | 56 | CIPHPUnitTestSuperGlobal::set_Global('BM', $BM); |
| 57 | - $EXT =& load_class('Hooks', 'core'); |
|
| 57 | + $EXT = & load_class('Hooks', 'core'); |
|
| 58 | 58 | CIPHPUnitTestSuperGlobal::set_Global('EXT', $EXT); |
| 59 | - $CFG =& load_class('Config', 'core'); |
|
| 59 | + $CFG = & load_class('Config', 'core'); |
|
| 60 | 60 | CIPHPUnitTestSuperGlobal::set_Global('CFG', $CFG); |
| 61 | - $UNI =& load_class('URI', 'core'); |
|
| 61 | + $UNI = & load_class('URI', 'core'); |
|
| 62 | 62 | CIPHPUnitTestSuperGlobal::set_Global('UNI', $UNI); |
| 63 | 63 | // $URI =& load_class('Utf8', 'core'); |
| 64 | 64 | // CIPHPUnitTestSuperGlobal::set_Global('URI', $URI); |
| 65 | - $RTR =& load_class('Router', 'core'); |
|
| 65 | + $RTR = & load_class('Router', 'core'); |
|
| 66 | 66 | CIPHPUnitTestSuperGlobal::set_Global('RTR', $RTR); |
| 67 | - $OUT =& load_class('Output', 'core'); |
|
| 67 | + $OUT = & load_class('Output', 'core'); |
|
| 68 | 68 | CIPHPUnitTestSuperGlobal::set_Global('OUT', $OUT); |
| 69 | - $SEC =& load_class('Security', 'core'); |
|
| 69 | + $SEC = & load_class('Security', 'core'); |
|
| 70 | 70 | CIPHPUnitTestSuperGlobal::set_Global('SEC', $SEC); |
| 71 | - $IN =& load_class('Input', 'core'); |
|
| 71 | + $IN = & load_class('Input', 'core'); |
|
| 72 | 72 | CIPHPUnitTestSuperGlobal::set_Global('IN', $IN); |
| 73 | - $LANG =& load_class('Lang', 'core'); |
|
| 73 | + $LANG = & load_class('Lang', 'core'); |
|
| 74 | 74 | CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG); |
| 75 | 75 | |
| 76 | 76 | CIPHPUnitTest::loadLoader(); |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function getRoute() |
| 21 | 21 | { |
| 22 | - $RTR =& load_class('Router', 'core'); |
|
| 23 | - $URI =& load_class('URI', 'core'); |
|
| 22 | + $RTR = & load_class('Router', 'core'); |
|
| 23 | + $URI = & load_class('URI', 'core'); |
|
| 24 | 24 | |
| 25 | 25 | $e404 = FALSE; |
| 26 | 26 | $class = ucfirst($RTR->class); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | // If 404, CodeIgniter instance is not created yet. So create it here. |
| 59 | 59 | // Because we need CI->output->_status |
| 60 | - $CI =& get_instance(); |
|
| 60 | + $CI = & get_instance(); |
|
| 61 | 61 | if ($CI instanceof CIPHPUnitTestNullCodeIgniter) |
| 62 | 62 | { |
| 63 | 63 | CIPHPUnitTest::createCodeIgniterInstance(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | self::outputMessage($msg); |
| 52 | 52 | throw new LogicException($msg); |
| 53 | 53 | } |
| 54 | - if (! FunctionPatcher::isWhitelisted($function)) |
|
| 54 | + if ( ! FunctionPatcher::isWhitelisted($function)) |
|
| 55 | 55 | { |
| 56 | 56 | $msg = "<red>Can't patch on '$function'. It is not in whitelist. If you want to patch it, please add it to 'functions_to_patch' in 'tests/Bootstrap.php'. But note that there are some limitations. See <https://github.com/kenjis/ci-phpunit-test/blob/master/docs/HowToWriteTests.md#patching-functions> for details.</red>"; |
| 57 | 57 | self::outputMessage($msg); |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | $line = $info['line']; |
| 98 | 98 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
| 99 | 99 | |
| 100 | - $log_args = function () use ($arguments) { |
|
| 100 | + $log_args = function() use ($arguments) { |
|
| 101 | 101 | $output = ''; |
| 102 | 102 | foreach ($arguments as $arg) { |
| 103 | - $output .= var_export($arg, true) . ', '; |
|
| 103 | + $output .= var_export($arg, true).', '; |
|
| 104 | 104 | } |
| 105 | 105 | $output = rtrim($output, ', '); |
| 106 | 106 | return $output; |
| 107 | 107 | }; |
| 108 | 108 | MonkeyPatchManager::log( |
| 109 | - 'invoke_func: ' . $function . '(' . $log_args() . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
| 109 | + 'invoke_func: '.$function.'('.$log_args().') on line '.$line.' in '.$file.' by '.$method.'()' |
|
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | if (isset(self::$patches_to_apply[$function])) |
| 150 | 150 | { |
| 151 | - if (! self::checkCalledMethod($function)) |
|
| 151 | + if ( ! self::checkCalledMethod($function)) |
|
| 152 | 152 | { |
| 153 | 153 | MonkeyPatchManager::log( |
| 154 | - 'invoke_func: ' . $function . '() not patched (out of scope)' |
|
| 154 | + 'invoke_func: '.$function.'() not patched (out of scope)' |
|
| 155 | 155 | ); |
| 156 | 156 | self::checkPassedByReference($function); |
| 157 | 157 | return call_user_func_array($function, $arguments); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if (array_key_exists($function, self::$patches)) |
| 162 | 162 | { |
| 163 | - MonkeyPatchManager::log('invoke_func: ' . $function . '() patched'); |
|
| 163 | + MonkeyPatchManager::log('invoke_func: '.$function.'() patched'); |
|
| 164 | 164 | |
| 165 | 165 | if (is_callable(self::$patches[$function])) |
| 166 | 166 | { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | MonkeyPatchManager::log( |
| 181 | - 'invoke_func: ' . $function . '() not patched (no patch)' |
|
| 181 | + 'invoke_func: '.$function.'() not patched (no patch)' |
|
| 182 | 182 | ); |
| 183 | 183 | self::checkPassedByReference($function); |
| 184 | 184 | return call_user_func_array($function, $arguments); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $msg = str_replace( |
| 232 | 232 | ['<red>', '</red>'], [$red_begin, $red_end], $msg |
| 233 | 233 | ); |
| 234 | - echo $msg . "\n"; |
|
| 234 | + echo $msg."\n"; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | public function leaveNode(Node $node) |
| 38 | 38 | { |
| 39 | - if (! ($node instanceof FuncCall)) |
|
| 39 | + if ( ! ($node instanceof FuncCall)) |
|
| 40 | 40 | { |
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (! ($node->name instanceof Name)) |
|
| 44 | + if ( ! ($node->name instanceof Name)) |
|
| 45 | 45 | { |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (! $node->name->isUnqualified()) |
|
| 49 | + if ( ! $node->name->isUnqualified()) |
|
| 50 | 50 | { |
| 51 | 51 | return; |
| 52 | 52 | } |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | FunctionPatcher::isWhitelisted((string) $node->name) |
| 56 | 56 | && ! FunctionPatcher::isBlacklisted((string) $node->name) |
| 57 | 57 | ) { |
| 58 | - $replacement = new FullyQualified('\__FuncProxy__::' . (string) $node->name); |
|
| 58 | + $replacement = new FullyQualified('\__FuncProxy__::'.(string) $node->name); |
|
| 59 | 59 | |
| 60 | 60 | $pos = $node->getAttribute('startTokenPos'); |
| 61 | 61 | FunctionPatcher::$replacement[$pos] = |
| 62 | - '\__FuncProxy__::' . (string) $node->name; |
|
| 62 | + '\__FuncProxy__::'.(string) $node->name; |
|
| 63 | 63 | |
| 64 | 64 | $node->name = $replacement; |
| 65 | 65 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
| 66 | 66 | |
| 67 | 67 | MonkeyPatchManager::log( |
| 68 | - 'invoke_const: ' . $constant . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
| 68 | + 'invoke_const: '.$constant.') on line '.$line.' in '.$file.' by '.$method.'()' |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if (isset(self::$patches_to_apply[$constant])) |
| 113 | 113 | { |
| 114 | - if (! self::checkCalledMethod($constant)) |
|
| 114 | + if ( ! self::checkCalledMethod($constant)) |
|
| 115 | 115 | { |
| 116 | 116 | MonkeyPatchManager::log( |
| 117 | - 'invoke_const: ' . $constant . ' not patched (out of scope)' |
|
| 117 | + 'invoke_const: '.$constant.' not patched (out of scope)' |
|
| 118 | 118 | ); |
| 119 | 119 | return constant($constant); |
| 120 | 120 | } |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | if (array_key_exists($constant, self::$patches)) |
| 124 | 124 | { |
| 125 | - MonkeyPatchManager::log('invoke_const: ' . $constant . ' patched'); |
|
| 125 | + MonkeyPatchManager::log('invoke_const: '.$constant.' patched'); |
|
| 126 | 126 | return self::$patches[$constant]; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | MonkeyPatchManager::log( |
| 130 | - 'invoke_const: ' . $constant . ' not patched (no patch)' |
|
| 130 | + 'invoke_const: '.$constant.' not patched (no patch)' |
|
| 131 | 131 | ); |
| 132 | 132 | return constant($constant); |
| 133 | 133 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function enterNode(Node $node) |
| 26 | 26 | { |
| 27 | - $callback = [$this, 'before' . ucfirst($node->getType())]; |
|
| 27 | + $callback = [$this, 'before'.ucfirst($node->getType())]; |
|
| 28 | 28 | if (is_callable($callback)) { |
| 29 | 29 | call_user_func_array($callback, [$node]); |
| 30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function leaveNode(Node $node) |
| 34 | 34 | { |
| 35 | - if (! ($node instanceof ConstFetch)) |
|
| 35 | + if ( ! ($node instanceof ConstFetch)) |
|
| 36 | 36 | { |
| 37 | - $callback = [$this, 'rewrite' . ucfirst($node->getType())]; |
|
| 37 | + $callback = [$this, 'rewrite'.ucfirst($node->getType())]; |
|
| 38 | 38 | if (is_callable($callback)) { |
| 39 | 39 | call_user_func_array($callback, [$node]); |
| 40 | 40 | } |
@@ -47,23 +47,23 @@ discard block |
||
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (! ($node->name instanceof Name)) |
|
| 50 | + if ( ! ($node->name instanceof Name)) |
|
| 51 | 51 | { |
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (! $node->name->isUnqualified()) |
|
| 55 | + if ( ! $node->name->isUnqualified()) |
|
| 56 | 56 | { |
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if (! ConstantPatcher::isBlacklisted((string) $node->name)) |
|
| 60 | + if ( ! ConstantPatcher::isBlacklisted((string) $node->name)) |
|
| 61 | 61 | { |
| 62 | - $replacement = new FullyQualified('\__ConstProxy__::get(\'' . (string) $node->name . '\')'); |
|
| 62 | + $replacement = new FullyQualified('\__ConstProxy__::get(\''.(string) $node->name.'\')'); |
|
| 63 | 63 | |
| 64 | 64 | $pos = $node->getAttribute('startTokenPos'); |
| 65 | 65 | ConstantPatcher::$replacement[$pos] = |
| 66 | - '\__ConstProxy__::get(\'' . (string) $node->name .'\')'; |
|
| 66 | + '\__ConstProxy__::get(\''.(string) $node->name.'\')'; |
|
| 67 | 67 | |
| 68 | 68 | $node->name = $replacement; |
| 69 | 69 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
| 12 | 12 | |
| 13 | -require __DIR__ . '/../Exception/ExitException.php'; |
|
| 13 | +require __DIR__.'/../Exception/ExitException.php'; |
|
| 14 | 14 | |
| 15 | 15 | class ExitPatcher |
| 16 | 16 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | elseif ($token[0] === T_EXIT) |
| 32 | 32 | { |
| 33 | - if ($tokens[$i+1] === ';') |
|
| 33 | + if ($tokens[$i + 1] === ';') |
|
| 34 | 34 | { |
| 35 | 35 | $new_source .= 'exit__()'; |
| 36 | 36 | } |