@@ -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 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
64 | 64 | |
65 | 65 | MonkeyPatchManager::log( |
66 | - 'invoke_const: ' . $constant . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
66 | + 'invoke_const: '.$constant.') on line '.$line.' in '.$file.' by '.$method.'()' |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | } |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | { |
107 | 107 | self::logInvocation($constant); |
108 | 108 | |
109 | - if (! empty(self::$patches_to_apply[$constant])) |
|
109 | + if ( ! empty(self::$patches_to_apply[$constant])) |
|
110 | 110 | { |
111 | - if (! self::checkCalledMethod($constant)) |
|
111 | + if ( ! self::checkCalledMethod($constant)) |
|
112 | 112 | { |
113 | 113 | MonkeyPatchManager::log( |
114 | - 'invoke_const: ' . $constant . ' not patched (out of scope)' |
|
114 | + 'invoke_const: '.$constant.' not patched (out of scope)' |
|
115 | 115 | ); |
116 | 116 | return constant($constant); |
117 | 117 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | if (array_key_exists($constant, self::$patches)) |
121 | 121 | { |
122 | - MonkeyPatchManager::log('invoke_const: ' . $constant . ' patched'); |
|
122 | + MonkeyPatchManager::log('invoke_const: '.$constant.' patched'); |
|
123 | 123 | return self::$patches[$constant]; |
124 | 124 | } |
125 | 125 | |
126 | 126 | MonkeyPatchManager::log( |
127 | - 'invoke_const: ' . $constant . ' not patched (no patch)' |
|
127 | + 'invoke_const: '.$constant.' not patched (no patch)' |
|
128 | 128 | ); |
129 | 129 | return constant($constant); |
130 | 130 | } |
@@ -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 | } |
@@ -12,36 +12,36 @@ |
||
12 | 12 | if (class_exists('PhpParser\Autoloader')) { |
13 | 13 | if (class_exists('PhpParser\Node\Identifier')) { |
14 | 14 | // PHP-Parser 4.x |
15 | - require __DIR__ . '/4.x/MonkeyPatchManager.php'; |
|
15 | + require __DIR__.'/4.x/MonkeyPatchManager.php'; |
|
16 | 16 | } |
17 | - elseif (method_exists('PhpParser\Node\Name','set')) { |
|
17 | + elseif (method_exists('PhpParser\Node\Name', 'set')) { |
|
18 | 18 | // PHP-Parser 2.x |
19 | - require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
|
19 | + require __DIR__.'/2.x/MonkeyPatchManager.php'; |
|
20 | 20 | } else { |
21 | 21 | // PHP-Parser 3.x |
22 | - require __DIR__ . '/3.x/MonkeyPatchManager.php'; |
|
22 | + require __DIR__.'/3.x/MonkeyPatchManager.php'; |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | // If you don't use Composer |
26 | 26 | else { |
27 | 27 | if (version_compare(PHP_VERSION, '5.5.0', '>=')) { |
28 | 28 | // Use PHP-Parser 3.x |
29 | - require __DIR__ . '/third_party/PHP-Parser-3.1.5/lib/bootstrap.php'; |
|
30 | - require __DIR__ . '/3.x/MonkeyPatchManager.php'; |
|
29 | + require __DIR__.'/third_party/PHP-Parser-3.1.5/lib/bootstrap.php'; |
|
30 | + require __DIR__.'/3.x/MonkeyPatchManager.php'; |
|
31 | 31 | } else { |
32 | 32 | // Use PHP-Parser 2.x |
33 | - require __DIR__ . '/third_party/PHP-Parser-2.1.1/lib/bootstrap.php'; |
|
34 | - require __DIR__ . '/2.x/MonkeyPatchManager.php'; |
|
33 | + require __DIR__.'/third_party/PHP-Parser-2.1.1/lib/bootstrap.php'; |
|
34 | + require __DIR__.'/2.x/MonkeyPatchManager.php'; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -require __DIR__ . '/IncludeStream.php'; |
|
39 | -require __DIR__ . '/PathChecker.php'; |
|
40 | -require __DIR__ . '/MonkeyPatch.php'; |
|
41 | -require __DIR__ . '/Cache.php'; |
|
42 | -require __DIR__ . '/InvocationVerifier.php'; |
|
38 | +require __DIR__.'/IncludeStream.php'; |
|
39 | +require __DIR__.'/PathChecker.php'; |
|
40 | +require __DIR__.'/MonkeyPatch.php'; |
|
41 | +require __DIR__.'/Cache.php'; |
|
42 | +require __DIR__.'/InvocationVerifier.php'; |
|
43 | 43 | |
44 | -require __DIR__ . '/functions/exit__.php'; |
|
44 | +require __DIR__.'/functions/exit__.php'; |
|
45 | 45 | |
46 | 46 | const __GO_TO_ORIG__ = '__GO_TO_ORIG__'; |
47 | 47 |
@@ -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 | |
18 | 18 | public function __construct($argv) |
19 | 19 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | for ($i = 1; $i <= $argc; $i++) { |
32 | - if (! isset($argv[$i])) { |
|
32 | + if ( ! isset($argv[$i])) { |
|
33 | 33 | break; |
34 | 34 | } |
35 | 35 | |
@@ -41,29 +41,29 @@ discard block |
||
41 | 41 | |
42 | 42 | // php install.php -a application |
43 | 43 | case '-a': |
44 | - if (is_dir($argv[$i+1])) { |
|
45 | - $this->app_dir = $argv[$i+1]; |
|
44 | + if (is_dir($argv[$i + 1])) { |
|
45 | + $this->app_dir = $argv[$i + 1]; |
|
46 | 46 | } else { |
47 | - throw new Exception('No such application directory: '.$argv[$i+1]); |
|
47 | + throw new Exception('No such application directory: '.$argv[$i + 1]); |
|
48 | 48 | } |
49 | 49 | $i++; |
50 | 50 | break; |
51 | 51 | |
52 | 52 | // php install.php -p public |
53 | 53 | case '-p': |
54 | - if (is_dir($argv[$i+1])) { |
|
55 | - $this->pub_dir = $argv[$i+1]; |
|
54 | + if (is_dir($argv[$i + 1])) { |
|
55 | + $this->pub_dir = $argv[$i + 1]; |
|
56 | 56 | } else { |
57 | - throw new Exception('No such public directory: '.$argv[$i+1]); |
|
57 | + throw new Exception('No such public directory: '.$argv[$i + 1]); |
|
58 | 58 | } |
59 | 59 | $i++; |
60 | 60 | break; |
61 | 61 | // php install.php -t application/tests |
62 | 62 | case '-t': |
63 | - if (is_dir($argv[$i+1])) { |
|
64 | - $this->test_dir = $argv[$i+1]; |
|
63 | + if (is_dir($argv[$i + 1])) { |
|
64 | + $this->test_dir = $argv[$i + 1]; |
|
65 | 65 | } else { |
66 | - throw new Exception('No such test directory: '.$argv[$i+1]); |
|
66 | + throw new Exception('No such test directory: '.$argv[$i + 1]); |
|
67 | 67 | } |
68 | 68 | $i++; |
69 | 69 | break; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $file = $this->test_dir.'/Bootstrap.php'; |
95 | 95 | $contents = file_get_contents($file); |
96 | 96 | |
97 | - if (! file_exists('system')) { |
|
97 | + if ( ! file_exists('system')) { |
|
98 | 98 | if (file_exists('vendor/codeigniter/framework/system')) { |
99 | 99 | $contents = str_replace( |
100 | 100 | '$system_path = \'../../system\';', |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - if (! file_exists('index.php')) { |
|
109 | + if ( ! file_exists('index.php')) { |
|
110 | 110 | if (file_exists($this->pub_dir.'/index.php')) { |
111 | 111 | // CodeIgniter 3.0.6 and after |
112 | 112 | $contents = str_replace( |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } else { |
180 | 180 | $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
181 | 181 | if ($success) { |
182 | - if (! $this->silent) { |
|
182 | + if ( ! $this->silent) { |
|
183 | 183 | echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
184 | 184 | } |
185 | 185 | } |