@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | if ($this->db === null) |
| 37 | 37 | { |
| 38 | - $CI =& get_instance(); |
|
| 38 | + $CI = & get_instance(); |
|
| 39 | 39 | $CI->load->database(); |
| 40 | 40 | $this->db = $CI->db; |
| 41 | 41 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $this->checkDbConnId(); |
| 58 | 58 | |
| 59 | - if (! empty($this->insertCache)) |
|
| 59 | + if ( ! empty($this->insertCache)) |
|
| 60 | 60 | { |
| 61 | 61 | foreach ($this->insertCache as $row) |
| 62 | 62 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->db->close(); |
| 84 | 84 | $this->db = null; |
| 85 | 85 | |
| 86 | - $CI =& get_instance(); |
|
| 86 | + $CI = & get_instance(); |
|
| 87 | 87 | $CI->load->database(); |
| 88 | 88 | $this->db = $CI->db; |
| 89 | 89 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param string $classname |
| 34 | 34 | * @param array $params [method_name => return_value] |
| 35 | - * @param mixed $constructor_params false: disable constructor, array: constructor params |
|
| 35 | + * @param boolean $constructor_params false: disable constructor, array: constructor params |
|
| 36 | 36 | * |
| 37 | 37 | * @return mixed PHPUnit mock object |
| 38 | 38 | */ |
@@ -95,6 +95,10 @@ discard block |
||
| 95 | 95 | return $mock; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + /** |
|
| 99 | + * @param string $method |
|
| 100 | + * @param string $with |
|
| 101 | + */ |
|
| 98 | 102 | protected function _verify($mock, $method, $params = null, $expects, $with) |
| 99 | 103 | { |
| 100 | 104 | $invocation = $mock->expects($expects) |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | if ($constructor_params === false) |
| 47 | 47 | { |
| 48 | 48 | $mockBuilder->disableOriginalConstructor(); |
| 49 | - } |
|
| 50 | - elseif (is_array($constructor_params)) |
|
| 49 | + } elseif (is_array($constructor_params)) |
|
| 51 | 50 | { |
| 52 | 51 | $mockBuilder->setConstructorArgs($constructor_params); |
| 53 | 52 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (TestCase::isTestingEnv()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! TestCase::isTestingEnv()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! TestCase::isTestingEnv()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (TestCase::isTestingEnv()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! TestCase::isTestingEnv()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! TestCase::isTestingEnv()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (TestCase::isTestingEnv()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! TestCase::isTestingEnv()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! TestCase::isTestingEnv()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (TestCase::isTestingEnv()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! TestCase::isTestingEnv()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! TestCase::isTestingEnv()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Load the mime types |
| 75 | - $mimes =& get_mimes(); |
|
| 75 | + $mimes = & get_mimes(); |
|
| 76 | 76 | |
| 77 | 77 | // Only change the default MIME if we can find one |
| 78 | 78 | if (isset($mimes[$extension])) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (TestCase::isTestingEnv()) |
| 119 | 119 | { |
| 120 | - $CI =& get_instance(); |
|
| 120 | + $CI = & get_instance(); |
|
| 121 | 121 | $CI->output->set_header('Content-Type: '.$mime); |
| 122 | 122 | $CI->output->set_header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 123 | 123 | $CI->output->set_header('Expires: 0'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | if ($filename === '' OR $data === '') |
| 39 | 39 | { |
| 40 | 40 | return; |
| 41 | - } |
|
| 42 | - elseif ($data === NULL) |
|
| 41 | + } elseif ($data === NULL) |
|
| 43 | 42 | { |
| 44 | 43 | if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) |
| 45 | 44 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | $filepath = $filename; |
| 50 | 49 | $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); |
| 51 | 50 | $filename = end($filename); |
| 52 | - } |
|
| 53 | - else |
|
| 51 | + } else |
|
| 54 | 52 | { |
| 55 | 53 | $filesize = strlen($data); |
| 56 | 54 | } |
@@ -137,8 +135,7 @@ discard block |
||
| 137 | 135 | if ( ! TestCase::isTestingEnv()) |
| 138 | 136 | { |
| 139 | 137 | exit($data); |
| 140 | - } |
|
| 141 | - else |
|
| 138 | + } else |
|
| 142 | 139 | { |
| 143 | 140 | echo($data); |
| 144 | 141 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
@@ -155,8 +152,7 @@ discard block |
||
| 155 | 152 | if ( ! TestCase::isTestingEnv()) |
| 156 | 153 | { |
| 157 | 154 | exit; |
| 158 | - } |
|
| 159 | - else |
|
| 155 | + } else |
|
| 160 | 156 | { |
| 161 | 157 | throw new CIPHPUnitTestExitException('exit() from force_download()'); |
| 162 | 158 | } |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | class Installer |
| 12 | 12 | { |
| 13 | 13 | private $silent = false; |
| 14 | - private $app_dir = 'application'; // -a DIRECTORY |
|
| 15 | - private $pub_dir = 'public'; // -p DIRECTORY |
|
| 16 | - private $test_dir = null; // -t DIRECTORY |
|
| 14 | + private $app_dir = 'application'; // -a DIRECTORY |
|
| 15 | + private $pub_dir = 'public'; // -p DIRECTORY |
|
| 16 | + private $test_dir = null; // -t DIRECTORY |
|
| 17 | 17 | private $from_composer = false; |
| 18 | 18 | |
| 19 | 19 | public function __construct($argv) |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | for ($i = 1; $i <= $argc; $i++) { |
| 33 | - if (! isset($argv[$i])) { |
|
| 33 | + if ( ! isset($argv[$i])) { |
|
| 34 | 34 | break; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -42,29 +42,29 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | // php install.php -a application |
| 44 | 44 | case '-a': |
| 45 | - if (is_dir($argv[$i+1])) { |
|
| 46 | - $this->app_dir = $argv[$i+1]; |
|
| 45 | + if (is_dir($argv[$i + 1])) { |
|
| 46 | + $this->app_dir = $argv[$i + 1]; |
|
| 47 | 47 | } else { |
| 48 | - throw new Exception('No such application directory: '.$argv[$i+1]); |
|
| 48 | + throw new Exception('No such application directory: '.$argv[$i + 1]); |
|
| 49 | 49 | } |
| 50 | 50 | $i++; |
| 51 | 51 | break; |
| 52 | 52 | |
| 53 | 53 | // php install.php -p public |
| 54 | 54 | case '-p': |
| 55 | - if (is_dir($argv[$i+1])) { |
|
| 56 | - $this->pub_dir = $argv[$i+1]; |
|
| 55 | + if (is_dir($argv[$i + 1])) { |
|
| 56 | + $this->pub_dir = $argv[$i + 1]; |
|
| 57 | 57 | } else { |
| 58 | - throw new Exception('No such public directory: '.$argv[$i+1]); |
|
| 58 | + throw new Exception('No such public directory: '.$argv[$i + 1]); |
|
| 59 | 59 | } |
| 60 | 60 | $i++; |
| 61 | 61 | break; |
| 62 | 62 | // php install.php -t application/tests |
| 63 | 63 | case '-t': |
| 64 | - if (is_dir($argv[$i+1])) { |
|
| 65 | - $this->test_dir = $argv[$i+1]; |
|
| 64 | + if (is_dir($argv[$i + 1])) { |
|
| 65 | + $this->test_dir = $argv[$i + 1]; |
|
| 66 | 66 | } else { |
| 67 | - throw new Exception('No such test directory: '.$argv[$i+1]); |
|
| 67 | + throw new Exception('No such test directory: '.$argv[$i + 1]); |
|
| 68 | 68 | } |
| 69 | 69 | $i++; |
| 70 | 70 | break; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $file = $this->test_dir.'/Bootstrap.php'; |
| 106 | 106 | $contents = file_get_contents($file); |
| 107 | 107 | |
| 108 | - if (! file_exists('system')) { |
|
| 108 | + if ( ! file_exists('system')) { |
|
| 109 | 109 | if (file_exists('vendor/codeigniter/framework/system')) { |
| 110 | 110 | $contents = str_replace( |
| 111 | 111 | '$system_path = \'../../system\';', |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (! file_exists('index.php')) { |
|
| 120 | + if ( ! file_exists('index.php')) { |
|
| 121 | 121 | if (file_exists($this->pub_dir.'/index.php')) { |
| 122 | 122 | // CodeIgniter 3.0.6 and after |
| 123 | 123 | $contents = str_replace( |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } else { |
| 191 | 191 | $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
| 192 | 192 | if ($success) { |
| 193 | - if (! $this->silent) { |
|
| 193 | + if ( ! $this->silent) { |
|
| 194 | 194 | echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -10,219 +10,219 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Installer |
| 12 | 12 | { |
| 13 | - private $silent = false; |
|
| 14 | - private $app_dir = 'application'; // -a DIRECTORY |
|
| 15 | - private $pub_dir = 'public'; // -p DIRECTORY |
|
| 16 | - private $test_dir = null; // -t DIRECTORY |
|
| 17 | - private $from_composer = false; |
|
| 18 | - |
|
| 19 | - public function __construct($argv) |
|
| 20 | - { |
|
| 21 | - $this->parse_args($argv); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - private function parse_args($argv) |
|
| 25 | - { |
|
| 26 | - $argc = count($argv); |
|
| 27 | - |
|
| 28 | - if ($argc === 1) { |
|
| 29 | - if (is_null($this->test_dir)) { |
|
| 30 | - $this->test_dir = $this->app_dir.'/tests'; |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - return; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - for ($i = 1; $i <= $argc; $i++) { |
|
| 37 | - if (! isset($argv[$i])) { |
|
| 38 | - break; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - switch ($argv[$i]) { |
|
| 42 | - // php install.php -s |
|
| 43 | - case '-s': |
|
| 44 | - $this->silent = true; |
|
| 45 | - break; |
|
| 46 | - |
|
| 47 | - // php install.php -a application |
|
| 48 | - case '-a': |
|
| 49 | - if (is_dir($argv[$i+1])) { |
|
| 50 | - $this->app_dir = $argv[$i+1]; |
|
| 51 | - } else { |
|
| 52 | - throw new Exception('No such application directory: '.$argv[$i+1]); |
|
| 53 | - } |
|
| 54 | - $i++; |
|
| 55 | - break; |
|
| 56 | - |
|
| 57 | - // php install.php -p public |
|
| 58 | - case '-p': |
|
| 59 | - if (is_dir($argv[$i+1])) { |
|
| 60 | - $this->pub_dir = $argv[$i+1]; |
|
| 61 | - } else { |
|
| 62 | - throw new Exception('No such public directory: '.$argv[$i+1]); |
|
| 63 | - } |
|
| 64 | - $i++; |
|
| 65 | - break; |
|
| 66 | - |
|
| 67 | - // php install.php -t application/tests |
|
| 68 | - case '-t': |
|
| 69 | - if (is_dir($argv[$i+1])) { |
|
| 70 | - $this->test_dir = $argv[$i+1]; |
|
| 71 | - } else { |
|
| 72 | - throw new Exception('No such test directory: '.$argv[$i+1]); |
|
| 73 | - } |
|
| 74 | - $i++; |
|
| 75 | - break; |
|
| 76 | - |
|
| 77 | - case '--from-composer': |
|
| 78 | - $this->from_composer = true; |
|
| 79 | - break; |
|
| 80 | - |
|
| 81 | - default: |
|
| 82 | - throw new Exception('Unknown argument: '.$argv[$i]); |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - if (is_null($this->test_dir)) { |
|
| 87 | - $this->test_dir = $this->app_dir.'/tests'; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - public function install() |
|
| 92 | - { |
|
| 93 | - $this->recursiveCopy( |
|
| 94 | - dirname(dirname(__FILE__)).'/application/tests', |
|
| 95 | - $this->test_dir |
|
| 96 | - ); |
|
| 97 | - $this->fixPath(); |
|
| 98 | - if ($this->from_composer) { |
|
| 99 | - $this->recursiveUnlink($this->app_dir.'/'.$this->test_dir.'/_ci_phpunit_test'); |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Fix paths in Bootstrap.php |
|
| 105 | - * |
|
| 106 | - * @FIXME Too ad hoc. Must rewrite, because can't handle complex paths. |
|
| 107 | - */ |
|
| 108 | - private function fixPath() |
|
| 109 | - { |
|
| 110 | - $file = $this->test_dir.'/Bootstrap.php'; |
|
| 111 | - $contents = file_get_contents($file); |
|
| 112 | - |
|
| 113 | - if (! file_exists('system')) { |
|
| 114 | - if (file_exists('vendor/codeigniter/framework/system')) { |
|
| 115 | - $contents = str_replace( |
|
| 116 | - '$system_path = \'../../system\';', |
|
| 117 | - '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
| 118 | - $contents |
|
| 119 | - ); |
|
| 120 | - } else { |
|
| 121 | - throw new Exception('Can\'t find "system" folder.'); |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - if (! file_exists('index.php')) { |
|
| 126 | - if (file_exists($this->pub_dir.'/index.php')) { |
|
| 127 | - // CodeIgniter 3.0.6 and after |
|
| 128 | - $contents = str_replace( |
|
| 129 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
| 130 | - "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').DIRECTORY_SEPARATOR);", |
|
| 131 | - $contents |
|
| 132 | - ); |
|
| 133 | - // CodeIgniter 3.0.5 and before |
|
| 134 | - $contents = str_replace( |
|
| 135 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 136 | - "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').'/');", |
|
| 137 | - $contents |
|
| 138 | - ); |
|
| 139 | - } elseif (file_exists($this->app_dir.'/public/index.php')) { |
|
| 140 | - // CodeIgniter 3.0.6 and after |
|
| 141 | - $contents = str_replace( |
|
| 142 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
| 143 | - "define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);", |
|
| 144 | - $contents |
|
| 145 | - ); |
|
| 146 | - // CodeIgniter 3.0.5 and before |
|
| 147 | - $contents = str_replace( |
|
| 148 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 149 | - "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
|
| 150 | - $contents |
|
| 151 | - ); |
|
| 152 | - if ($this->app_dir !== 'application') { |
|
| 153 | - $contents = str_replace( |
|
| 154 | - "\$application_folder = '../../application';", |
|
| 155 | - "\$application_folder = '../../{$this->app_dir}';", |
|
| 156 | - $contents |
|
| 157 | - ); |
|
| 158 | - } |
|
| 159 | - } else { |
|
| 160 | - throw new Exception('Can\'t find "index.php".'); |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - file_put_contents($file, $contents); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - public function update() |
|
| 168 | - { |
|
| 169 | - $target_dir = $this->test_dir.'/_ci_phpunit_test'; |
|
| 170 | - $this->recursiveUnlink($target_dir); |
|
| 171 | - $this->recursiveCopy( |
|
| 172 | - dirname(dirname(__FILE__)).'/application/tests/_ci_phpunit_test', |
|
| 173 | - $target_dir |
|
| 174 | - ); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Recursive Copy |
|
| 179 | - * |
|
| 180 | - * @param string $src |
|
| 181 | - * @param string $dst |
|
| 182 | - */ |
|
| 183 | - private function recursiveCopy($src, $dst) |
|
| 184 | - { |
|
| 185 | - @mkdir($dst, 0755); |
|
| 186 | - |
|
| 187 | - $iterator = new \RecursiveIteratorIterator( |
|
| 188 | - new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 189 | - \RecursiveIteratorIterator::SELF_FIRST |
|
| 190 | - ); |
|
| 191 | - |
|
| 192 | - foreach ($iterator as $file) { |
|
| 193 | - if ($file->isDir()) { |
|
| 194 | - @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
| 195 | - } else { |
|
| 196 | - $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
| 197 | - if ($success) { |
|
| 198 | - if (! $this->silent) { |
|
| 199 | - echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Recursive Unlink |
|
| 208 | - * |
|
| 209 | - * @param string $dir |
|
| 210 | - */ |
|
| 211 | - private function recursiveUnlink($dir) |
|
| 212 | - { |
|
| 213 | - $iterator = new \RecursiveIteratorIterator( |
|
| 214 | - new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 215 | - \RecursiveIteratorIterator::CHILD_FIRST |
|
| 216 | - ); |
|
| 217 | - |
|
| 218 | - foreach ($iterator as $file) { |
|
| 219 | - if ($file->isDir()) { |
|
| 220 | - rmdir($file); |
|
| 221 | - } else { |
|
| 222 | - unlink($file); |
|
| 223 | - } |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - rmdir($dir); |
|
| 227 | - } |
|
| 13 | + private $silent = false; |
|
| 14 | + private $app_dir = 'application'; // -a DIRECTORY |
|
| 15 | + private $pub_dir = 'public'; // -p DIRECTORY |
|
| 16 | + private $test_dir = null; // -t DIRECTORY |
|
| 17 | + private $from_composer = false; |
|
| 18 | + |
|
| 19 | + public function __construct($argv) |
|
| 20 | + { |
|
| 21 | + $this->parse_args($argv); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + private function parse_args($argv) |
|
| 25 | + { |
|
| 26 | + $argc = count($argv); |
|
| 27 | + |
|
| 28 | + if ($argc === 1) { |
|
| 29 | + if (is_null($this->test_dir)) { |
|
| 30 | + $this->test_dir = $this->app_dir.'/tests'; |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + return; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + for ($i = 1; $i <= $argc; $i++) { |
|
| 37 | + if (! isset($argv[$i])) { |
|
| 38 | + break; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + switch ($argv[$i]) { |
|
| 42 | + // php install.php -s |
|
| 43 | + case '-s': |
|
| 44 | + $this->silent = true; |
|
| 45 | + break; |
|
| 46 | + |
|
| 47 | + // php install.php -a application |
|
| 48 | + case '-a': |
|
| 49 | + if (is_dir($argv[$i+1])) { |
|
| 50 | + $this->app_dir = $argv[$i+1]; |
|
| 51 | + } else { |
|
| 52 | + throw new Exception('No such application directory: '.$argv[$i+1]); |
|
| 53 | + } |
|
| 54 | + $i++; |
|
| 55 | + break; |
|
| 56 | + |
|
| 57 | + // php install.php -p public |
|
| 58 | + case '-p': |
|
| 59 | + if (is_dir($argv[$i+1])) { |
|
| 60 | + $this->pub_dir = $argv[$i+1]; |
|
| 61 | + } else { |
|
| 62 | + throw new Exception('No such public directory: '.$argv[$i+1]); |
|
| 63 | + } |
|
| 64 | + $i++; |
|
| 65 | + break; |
|
| 66 | + |
|
| 67 | + // php install.php -t application/tests |
|
| 68 | + case '-t': |
|
| 69 | + if (is_dir($argv[$i+1])) { |
|
| 70 | + $this->test_dir = $argv[$i+1]; |
|
| 71 | + } else { |
|
| 72 | + throw new Exception('No such test directory: '.$argv[$i+1]); |
|
| 73 | + } |
|
| 74 | + $i++; |
|
| 75 | + break; |
|
| 76 | + |
|
| 77 | + case '--from-composer': |
|
| 78 | + $this->from_composer = true; |
|
| 79 | + break; |
|
| 80 | + |
|
| 81 | + default: |
|
| 82 | + throw new Exception('Unknown argument: '.$argv[$i]); |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + if (is_null($this->test_dir)) { |
|
| 87 | + $this->test_dir = $this->app_dir.'/tests'; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + public function install() |
|
| 92 | + { |
|
| 93 | + $this->recursiveCopy( |
|
| 94 | + dirname(dirname(__FILE__)).'/application/tests', |
|
| 95 | + $this->test_dir |
|
| 96 | + ); |
|
| 97 | + $this->fixPath(); |
|
| 98 | + if ($this->from_composer) { |
|
| 99 | + $this->recursiveUnlink($this->app_dir.'/'.$this->test_dir.'/_ci_phpunit_test'); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Fix paths in Bootstrap.php |
|
| 105 | + * |
|
| 106 | + * @FIXME Too ad hoc. Must rewrite, because can't handle complex paths. |
|
| 107 | + */ |
|
| 108 | + private function fixPath() |
|
| 109 | + { |
|
| 110 | + $file = $this->test_dir.'/Bootstrap.php'; |
|
| 111 | + $contents = file_get_contents($file); |
|
| 112 | + |
|
| 113 | + if (! file_exists('system')) { |
|
| 114 | + if (file_exists('vendor/codeigniter/framework/system')) { |
|
| 115 | + $contents = str_replace( |
|
| 116 | + '$system_path = \'../../system\';', |
|
| 117 | + '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
| 118 | + $contents |
|
| 119 | + ); |
|
| 120 | + } else { |
|
| 121 | + throw new Exception('Can\'t find "system" folder.'); |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + if (! file_exists('index.php')) { |
|
| 126 | + if (file_exists($this->pub_dir.'/index.php')) { |
|
| 127 | + // CodeIgniter 3.0.6 and after |
|
| 128 | + $contents = str_replace( |
|
| 129 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
| 130 | + "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').DIRECTORY_SEPARATOR);", |
|
| 131 | + $contents |
|
| 132 | + ); |
|
| 133 | + // CodeIgniter 3.0.5 and before |
|
| 134 | + $contents = str_replace( |
|
| 135 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 136 | + "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').'/');", |
|
| 137 | + $contents |
|
| 138 | + ); |
|
| 139 | + } elseif (file_exists($this->app_dir.'/public/index.php')) { |
|
| 140 | + // CodeIgniter 3.0.6 and after |
|
| 141 | + $contents = str_replace( |
|
| 142 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);", |
|
| 143 | + "define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);", |
|
| 144 | + $contents |
|
| 145 | + ); |
|
| 146 | + // CodeIgniter 3.0.5 and before |
|
| 147 | + $contents = str_replace( |
|
| 148 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 149 | + "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
|
| 150 | + $contents |
|
| 151 | + ); |
|
| 152 | + if ($this->app_dir !== 'application') { |
|
| 153 | + $contents = str_replace( |
|
| 154 | + "\$application_folder = '../../application';", |
|
| 155 | + "\$application_folder = '../../{$this->app_dir}';", |
|
| 156 | + $contents |
|
| 157 | + ); |
|
| 158 | + } |
|
| 159 | + } else { |
|
| 160 | + throw new Exception('Can\'t find "index.php".'); |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + file_put_contents($file, $contents); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + public function update() |
|
| 168 | + { |
|
| 169 | + $target_dir = $this->test_dir.'/_ci_phpunit_test'; |
|
| 170 | + $this->recursiveUnlink($target_dir); |
|
| 171 | + $this->recursiveCopy( |
|
| 172 | + dirname(dirname(__FILE__)).'/application/tests/_ci_phpunit_test', |
|
| 173 | + $target_dir |
|
| 174 | + ); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Recursive Copy |
|
| 179 | + * |
|
| 180 | + * @param string $src |
|
| 181 | + * @param string $dst |
|
| 182 | + */ |
|
| 183 | + private function recursiveCopy($src, $dst) |
|
| 184 | + { |
|
| 185 | + @mkdir($dst, 0755); |
|
| 186 | + |
|
| 187 | + $iterator = new \RecursiveIteratorIterator( |
|
| 188 | + new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 189 | + \RecursiveIteratorIterator::SELF_FIRST |
|
| 190 | + ); |
|
| 191 | + |
|
| 192 | + foreach ($iterator as $file) { |
|
| 193 | + if ($file->isDir()) { |
|
| 194 | + @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
| 195 | + } else { |
|
| 196 | + $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
| 197 | + if ($success) { |
|
| 198 | + if (! $this->silent) { |
|
| 199 | + echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Recursive Unlink |
|
| 208 | + * |
|
| 209 | + * @param string $dir |
|
| 210 | + */ |
|
| 211 | + private function recursiveUnlink($dir) |
|
| 212 | + { |
|
| 213 | + $iterator = new \RecursiveIteratorIterator( |
|
| 214 | + new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 215 | + \RecursiveIteratorIterator::CHILD_FIRST |
|
| 216 | + ); |
|
| 217 | + |
|
| 218 | + foreach ($iterator as $file) { |
|
| 219 | + if ($file->isDir()) { |
|
| 220 | + rmdir($file); |
|
| 221 | + } else { |
|
| 222 | + unlink($file); |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + rmdir($dir); |
|
| 227 | + } |
|
| 228 | 228 | } |
@@ -40,6 +40,9 @@ discard block |
||
| 40 | 40 | 'ConstantPatcher', |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $message |
|
| 45 | + */ |
|
| 43 | 46 | public static function log($message) |
| 44 | 47 | { |
| 45 | 48 | if (! self::$debug) |
@@ -224,6 +227,9 @@ discard block |
||
| 224 | 227 | } |
| 225 | 228 | } |
| 226 | 229 | |
| 230 | + /** |
|
| 231 | + * @param string $patcher |
|
| 232 | + */ |
|
| 227 | 233 | public static function isEnabled($patcher) |
| 228 | 234 | { |
| 229 | 235 | return in_array($patcher, self::$patcher_list); |
@@ -316,6 +322,9 @@ discard block |
||
| 316 | 322 | self::$load_patchers = true; |
| 317 | 323 | } |
| 318 | 324 | |
| 325 | + /** |
|
| 326 | + * @param string $source |
|
| 327 | + */ |
|
| 319 | 328 | protected static function execPatchers($source) |
| 320 | 329 | { |
| 321 | 330 | $patched = false; |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace Kenjis\MonkeyPatch; |
| 12 | 12 | |
| 13 | 13 | use LogicException; |
| 14 | -use RuntimeException; |
|
| 15 | 14 | use PhpParser\ParserFactory; |
| 16 | 15 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
| 17 | 16 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public static function log($message) |
| 43 | 43 | { |
| 44 | - if (! self::$debug) |
|
| 44 | + if ( ! self::$debug) |
|
| 45 | 45 | { |
| 46 | 46 | return; |
| 47 | 47 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | if (is_null(self::$log_file)) |
| 82 | 82 | { |
| 83 | - self::$log_file = __DIR__ . '/debug.log'; |
|
| 83 | + self::$log_file = __DIR__.'/debug.log'; |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | else |
| 94 | 94 | { |
| 95 | 95 | // APPPATH is constant in CodeIgniter |
| 96 | - Cache::setProjectRootDir(APPPATH . '../'); |
|
| 96 | + Cache::setProjectRootDir(APPPATH.'../'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (! isset($config['cache_dir'])) |
|
| 99 | + if ( ! isset($config['cache_dir'])) |
|
| 100 | 100 | { |
| 101 | 101 | throw new LogicException('You have to set "cache_dir"'); |
| 102 | 102 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | protected static function setPaths(array $config) |
| 107 | 107 | { |
| 108 | - if (! isset($config['include_paths'])) |
|
| 108 | + if ( ! isset($config['include_paths'])) |
|
| 109 | 109 | { |
| 110 | 110 | throw new LogicException('You have to set "include_paths"'); |
| 111 | 111 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | // Updated? |
| 167 | 167 | if ($cached !== $current) |
| 168 | 168 | { |
| 169 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 169 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 170 | 170 | Cache::clearSrcCache(); |
| 171 | 171 | Cache::writeTmpIncludePaths($current); |
| 172 | 172 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // Updated? |
| 178 | 178 | if ($cached !== $current) |
| 179 | 179 | { |
| 180 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 180 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 181 | 181 | Cache::clearSrcCache(); |
| 182 | 182 | Cache::writeTmpExcludePaths($current); |
| 183 | 183 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | // Updated? |
| 191 | 191 | if ($cached !== self::$patcher_list) |
| 192 | 192 | { |
| 193 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 193 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 194 | 194 | Cache::clearSrcCache(); |
| 195 | 195 | Cache::writeTmpPatcherList(self::$patcher_list); |
| 196 | 196 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | // Updated? |
| 205 | 205 | if ($cached !== $current) |
| 206 | 206 | { |
| 207 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 207 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 208 | 208 | Cache::clearSrcCache(); |
| 209 | 209 | Cache::writeTmpFunctionWhitelist($current); |
| 210 | 210 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public static function patch($path) |
| 268 | 268 | { |
| 269 | - if (! is_readable($path)) |
|
| 269 | + if ( ! is_readable($path)) |
|
| 270 | 270 | { |
| 271 | 271 | throw new LogicException("Can't read '$path'"); |
| 272 | 272 | } |
@@ -274,17 +274,17 @@ discard block |
||
| 274 | 274 | // Check cache file |
| 275 | 275 | if ($cache_file = Cache::getValidSrcCachePath($path)) |
| 276 | 276 | { |
| 277 | - self::log('cache_hit: ' . $path); |
|
| 277 | + self::log('cache_hit: '.$path); |
|
| 278 | 278 | return fopen($cache_file, 'r'); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - self::log('cache_miss: ' . $path); |
|
| 281 | + self::log('cache_miss: '.$path); |
|
| 282 | 282 | $source = file_get_contents($path); |
| 283 | 283 | |
| 284 | 284 | list($new_source, $patched) = self::execPatchers($source); |
| 285 | 285 | |
| 286 | 286 | // Write to cache file |
| 287 | - self::log('write_cache: ' . $path); |
|
| 287 | + self::log('write_cache: '.$path); |
|
| 288 | 288 | Cache::writeSrcCacheFile($path, $new_source); |
| 289 | 289 | |
| 290 | 290 | $resource = fopen('php://memory', 'rb+'); |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | return; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - require __DIR__ . '/Patcher/AbstractPatcher.php'; |
|
| 304 | - require __DIR__ . '/Patcher/Backtrace.php'; |
|
| 303 | + require __DIR__.'/Patcher/AbstractPatcher.php'; |
|
| 304 | + require __DIR__.'/Patcher/Backtrace.php'; |
|
| 305 | 305 | |
| 306 | 306 | foreach (self::$patcher_list as $classname) |
| 307 | 307 | { |
| 308 | - require __DIR__ . '/Patcher/' . $classname . '.php'; |
|
| 308 | + require __DIR__.'/Patcher/'.$classname.'.php'; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | self::$load_patchers = true; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $patched = false; |
| 317 | 317 | foreach (self::$patcher_list as $classname) |
| 318 | 318 | { |
| 319 | - $classname = 'Kenjis\MonkeyPatch\Patcher\\' . $classname; |
|
| 319 | + $classname = 'Kenjis\MonkeyPatch\Patcher\\'.$classname; |
|
| 320 | 320 | $patcher = new $classname; |
| 321 | 321 | list($source, $patched_this) = $patcher->patch($source); |
| 322 | 322 | $patched = $patched || $patched_this; |
@@ -70,8 +70,7 @@ |
||
| 70 | 70 | if (isset($config['root_dir'])) |
| 71 | 71 | { |
| 72 | 72 | Cache::setProjectRootDir($config['root_dir']); |
| 73 | - } |
|
| 74 | - else |
|
| 73 | + } else |
|
| 75 | 74 | { |
| 76 | 75 | // APPPATH is constant in CodeIgniter |
| 77 | 76 | Cache::setProjectRootDir(APPPATH . '../'); |