@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | // label |
24 | 24 | $receiver = $trace[0]; |
25 | - $method = (isset($trace[1]['class'])) ? " ({$trace[1]['class']}" . '::' . "{$trace[1]['function']})" : ''; |
|
25 | + $method = (isset($trace[1]['class'])) ? " ({$trace[1]['class']}".'::'."{$trace[1]['function']})" : ''; |
|
26 | 26 | preg_match( |
27 | 27 | "/{$receiver['function']}\((.+)[\s,\)]/is", |
28 | 28 | trim(file($receiver['file'])[$receiver['line'] - 1]), |
29 | 29 | $matches |
30 | 30 | ); |
31 | - list($varName, $varDump) = isset($matches[1]) ? [$matches[1], $varDump] : ['(void)', '<br>']; |
|
31 | + list($varName, $varDump) = isset($matches[1]) ? [$matches[1], $varDump] : ['(void)', '<br>']; |
|
32 | 32 | |
33 | 33 | if ($isCli) { |
34 | 34 | self::outputCli($varName, $var, $receiver, $method); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // contents |
54 | 54 | $isCli = (PHP_SAPI === 'cli'); |
55 | 55 | $htmlErrors = ini_get('html_errors'); |
56 | - if (! extension_loaded('xdebug')) { |
|
56 | + if (!extension_loaded('xdebug')) { |
|
57 | 57 | ini_set('html_errors', 'On'); |
58 | 58 | return [$htmlErrors, $isCli]; |
59 | 59 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $colorClose = "\033[0m"; |
101 | 101 | echo "{$colorOpenReverse}{$varName}{$colorClose} = "; |
102 | 102 | var_dump($var); |
103 | - echo $colorOpenPlain . "in {$colorOpenBold}{$receiver['file']}{$colorClose}{$colorOpenPlain}"; |
|
103 | + echo $colorOpenPlain."in {$colorOpenBold}{$receiver['file']}{$colorClose}{$colorOpenPlain}"; |
|
104 | 104 | echo "on line {$receiver['line']}{$method}{$colorClose}\n"; |
105 | 105 | } |
106 | 106 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private static function outputFb($var, $file, $line) |
115 | 115 | { |
116 | - $label = __FUNCTION__ . "() in {$file} on line {$line}"; |
|
116 | + $label = __FUNCTION__."() in {$file} on line {$line}"; |
|
117 | 117 | /** @noinspection PhpUndefinedClassInspection */ |
118 | 118 | /** @noinspection PhpUndefinedMethodInspection */ |
119 | 119 | FB::group($label); |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $fileArray = array_map('htmlspecialchars', $files); |
121 | 121 | $fileArray[$line - 1] = "<span class=\"hit-line\">{$fileArray[$line - 1]}</span>"; |
122 | 122 | $shortListArray = array_slice($fileArray, $line - $num, $num * 2); |
123 | - $shortListArray[$num - 1] = '<strong>' . $fileArray[$line - 1] . '</strong>'; |
|
123 | + $shortListArray[$num - 1] = '<strong>'.$fileArray[$line - 1].'</strong>'; |
|
124 | 124 | $shortList = implode('', $shortListArray); |
125 | - $shortList = '<pre class="short-list" style="background-color: #F0F0F9;">' . $shortList . '</pre>'; |
|
126 | - $result .= $shortList . '</div>'; |
|
125 | + $shortList = '<pre class="short-list" style="background-color: #F0F0F9;">'.$shortList.'</pre>'; |
|
126 | + $result .= $shortList.'</div>'; |
|
127 | 127 | |
128 | 128 | return $result; |
129 | 129 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $divObject = $this->divObject($arg); |
150 | 150 | $objHash = spl_object_hash($arg); |
151 | 151 | $link = "<a href=\"#\" class=\"\" data-toggle=\"collapse\" data-target=\"#obj{$objHash}\">"; |
152 | - $arg = $link . '(object) ' . $this->getObjectName($arg) . '</a>'; |
|
152 | + $arg = $link.'(object) '.$this->getObjectName($arg).'</a>'; |
|
153 | 153 | } |
154 | 154 | if (is_array($arg)) { |
155 | 155 | $this->makeArgsElementsScalar($arg); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $html .= "<tr><td>{$index}</td><td>{$type}</td></td><td>{$arg}</td></tr>"; |
158 | 158 | } |
159 | 159 | $html .= '</table>'; |
160 | - return $html . $divObject; |
|
160 | + return $html.$divObject; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | private function getObjectName($obj) |
207 | 207 | { |
208 | - return '<strong>' . get_class($obj) . '</strong><span class="weak">#' . spl_object_hash($obj) . '</span>'; |
|
208 | + return '<strong>'.get_class($obj).'</strong><span class="weak">#'.spl_object_hash($obj).'</span>'; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ) { |
95 | 95 | $this->viewTemplate = $exceptionTpl; |
96 | 96 | $this->response = $response; |
97 | - $this->errorPage = $errorPage ? : new ErrorPage; |
|
97 | + $this->errorPage = $errorPage ?: new ErrorPage; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function buildErrorPage($e, ResourceObject $response) |
134 | 134 | { |
135 | - $exceptionId = 'e' . $response->code . '-' . substr(md5((string) $e), 0, 5); |
|
135 | + $exceptionId = 'e'.$response->code.'-'.substr(md5((string) $e), 0, 5); |
|
136 | 136 | try { |
137 | 137 | throw $e; |
138 | 138 | } catch (ResourceNotFound $e) { |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | } |
180 | 180 | $response->headers['X-EXCEPTION-CLASS'] = get_class($e); |
181 | 181 | $response->headers['X-EXCEPTION-MESSAGE'] = str_replace(PHP_EOL, ' ', $e->getMessage()); |
182 | - $response->headers['X-EXCEPTION-CODE-FILE-LINE'] = '(' . $e->getCode() . ') ' . $e->getFile( |
|
183 | - ) . ':' . $e->getLine(); |
|
184 | - $previous = $e->getPrevious() ? (get_class($e->getPrevious()) . ': ' . str_replace( |
|
182 | + $response->headers['X-EXCEPTION-CODE-FILE-LINE'] = '('.$e->getCode().') '.$e->getFile( |
|
183 | + ).':'.$e->getLine(); |
|
184 | + $previous = $e->getPrevious() ? (get_class($e->getPrevious()).': '.str_replace( |
|
185 | 185 | PHP_EOL, |
186 | 186 | ' ', |
187 | 187 | $e->getPrevious()->getMessage() |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | $data = (string) $e; |
261 | 261 | $previousE = $e->getPrevious(); |
262 | 262 | if ($previousE) { |
263 | - $data .= PHP_EOL . PHP_EOL . '-- Previous Exception --' . PHP_EOL . PHP_EOL; |
|
263 | + $data .= PHP_EOL.PHP_EOL.'-- Previous Exception --'.PHP_EOL.PHP_EOL; |
|
264 | 264 | $data .= $previousE->getTraceAsString(); |
265 | 265 | } |
266 | - $data .= PHP_EOL . PHP_EOL . '-- Bindings --' . PHP_EOL . (string) $this->injector; |
|
266 | + $data .= PHP_EOL.PHP_EOL.'-- Bindings --'.PHP_EOL.(string) $this->injector; |
|
267 | 267 | $file = $this->getLogFilePath($exceptionId); |
268 | 268 | if (is_writable($this->logDir)) { |
269 | 269 | file_put_contents($file, $data); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | private function getResourcesUris() |
77 | 77 | { |
78 | 78 | $resources = []; |
79 | - $resourceDir = $this->appDir . '/Resource'; |
|
79 | + $resourceDir = $this->appDir.'/Resource'; |
|
80 | 80 | $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($resourceDir), RecursiveIteratorIterator::SELF_FIRST); |
81 | 81 | foreach ($iterator as $item) { |
82 | 82 | /** @var $item \SplFileInfo */ |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function getUri(\SplFileInfo $file, $resourceDir) |
101 | 101 | { |
102 | - $relativePath = strtolower(str_replace($resourceDir . '/', '', (string) $file)); |
|
102 | + $relativePath = strtolower(str_replace($resourceDir.'/', '', (string) $file)); |
|
103 | 103 | $path = explode('/', $relativePath); |
104 | 104 | $scheme = array_shift($path); |
105 | 105 | $appName = 'self'; |
106 | - $uri = "{$scheme}://{$appName}/" . implode('/', $path); |
|
106 | + $uri = "{$scheme}://{$appName}/".implode('/', $path); |
|
107 | 107 | $uri = substr($uri, 0, -4); |
108 | 108 | |
109 | 109 | return $uri; |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | $path = implode('/', array_map('ucwords', explode('/', $path))); |
141 | 141 | $path = str_replace('//', '/', $path); |
142 | 142 | // cut head / |
143 | - $filePath = $this->appDir . '/Resource/' . ucwords($url['scheme']) . $path . '.php'; |
|
144 | - $fileContents = file_get_contents(__DIR__ . '/resource.tpl'); |
|
143 | + $filePath = $this->appDir.'/Resource/'.ucwords($url['scheme']).$path.'.php'; |
|
144 | + $fileContents = file_get_contents(__DIR__.'/resource.tpl'); |
|
145 | 145 | $fileContents = str_replace('{$app}', $this->appName, $fileContents); |
146 | - $paths = explode('/', $this->appName . $path); |
|
146 | + $paths = explode('/', $this->appName.$path); |
|
147 | 147 | $class = array_pop($paths); |
148 | 148 | $appName = array_shift($paths); |
149 | 149 | $scheme = ucwords($url['scheme']); |
150 | 150 | $namespace = "{$appName}\\Resource\\{$scheme}"; |
151 | 151 | if (count($paths) > 0) { |
152 | - $namespace .= '\\' . implode('\\', $paths); |
|
152 | + $namespace .= '\\'.implode('\\', $paths); |
|
153 | 153 | } |
154 | 154 | $fileContents = str_replace('{$namespace}', $namespace, $fileContents); |
155 | 155 | $fileContents = str_replace('{$class}', $class, $fileContents); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | $params = []; |
207 | 207 | foreach ($allow as $method) { |
208 | - $refMethod = new \ReflectionMethod($ro, 'on' . $method); |
|
208 | + $refMethod = new \ReflectionMethod($ro, 'on'.$method); |
|
209 | 209 | $parameters = $refMethod->getParameters(); |
210 | 210 | $paramArray = []; |
211 | 211 | foreach ($parameters as $parameter) { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $this |
20 | 20 | ->bind('') |
21 | 21 | ->annotatedWith('exceptionTpl') |
22 | - ->toInstance(__DIR__ . '/template/exception.php'); |
|
22 | + ->toInstance(__DIR__.'/template/exception.php'); |
|
23 | 23 | $this |
24 | 24 | ->bind('BEAR\Resource\ResourceObject') |
25 | 25 | ->annotatedWith('errorPage') |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | private function getPageLog(ExtendedPdo $db, $page) |
58 | 58 | { |
59 | 59 | $result = $db->fetchAll( |
60 | - 'SELECT * FROM `log` WHERE `extra_page` = ' . "'{$page}' ORDER BY id ASC" |
|
60 | + 'SELECT * FROM `log` WHERE `extra_page` = '."'{$page}' ORDER BY id ASC" |
|
61 | 61 | ); |
62 | 62 | $logs = []; |
63 | 63 | $log = ''; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $body = print_a(json_decode($log['body'], true), "return:1"); |
90 | 90 | $meta = $this->getHeaderInfo($log['req'], $log['header']); |
91 | 91 | if ($meta) { |
92 | - $body .= '<i class="icon-info-sign"></i><br>' . print_a($meta, "return:1"); |
|
92 | + $body .= '<i class="icon-info-sign"></i><br>'.print_a($meta, "return:1"); |
|
93 | 93 | } |
94 | 94 | $tableBody .= <<<EOT |
95 | 95 | <tr> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | EOT; |
104 | 104 | } |
105 | 105 | $path = isset($log['path']) ? $log['path'] : ''; |
106 | - $body = $this->getTableOpen($path, $logs) . $tableBody . self::TABLE_CLOSE; |
|
106 | + $body = $this->getTableOpen($path, $logs).$tableBody.self::TABLE_CLOSE; |
|
107 | 107 | |
108 | 108 | return $body; |
109 | 109 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $meta = []; |
161 | 161 | |
162 | 162 | $method = substr($req, 0, 3); |
163 | - $onMethod = 'on' . ucwords($method); |
|
163 | + $onMethod = 'on'.ucwords($method); |
|
164 | 164 | $header = json_decode($header, true); |
165 | 165 | |
166 | 166 | // interceptors |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | private function getPath($path) |
54 | 54 | { |
55 | - if (! is_array($path)) { |
|
55 | + if (!is_array($path)) { |
|
56 | 56 | $isDir = 'true'; |
57 | 57 | $path = $this->root; |
58 | 58 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function service($pagePath, AppInterface $app, $appDir) |
34 | 34 | { |
35 | - global $app; // for template |
|
35 | + global $app; // for template |
|
36 | 36 | global $appDir; // for template |
37 | 37 | |
38 | 38 | $path = parse_url(substr($pagePath, 4))['path']; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $path .= 'index.php'; |
42 | 42 | } |
43 | 43 | $packageRoot = dirname(dirname(dirname(__DIR__))); |
44 | - $scriptFile = $packageRoot . '/var/www/dev/' . $path; |
|
44 | + $scriptFile = $packageRoot.'/var/www/dev/'.$path; |
|
45 | 45 | if (file_exists($scriptFile) && is_file($scriptFile)) { |
46 | 46 | /** @noinspection PhpIncludeInspection */ |
47 | 47 | ob_start(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function isDevWebService($sapiName, $requestUri) |
73 | 73 | { |
74 | 74 | $path = substr($requestUri, 0, 5); |
75 | - $isDevTool = ($sapiName !== 'cli') && ($path === '/dev' || $path === '/dev/'); |
|
75 | + $isDevTool = ($sapiName !== 'cli') && ($path === '/dev' || $path === '/dev/'); |
|
76 | 76 | |
77 | 77 | return $isDevTool; |
78 | 78 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function getCachedApp($appName, $context, $tmpDir) |
40 | 40 | { |
41 | - $injector = function () use ($appName, $context, $tmpDir) { |
|
41 | + $injector = function() use ($appName, $context, $tmpDir) { |
|
42 | 42 | $appModule = "{$appName}\Module\AppModule"; |
43 | 43 | return new Injector( |
44 | 44 | new Container(new Forge(new Config(new Annotation(new Definition, new AnnotationReader)))), |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | new DiLogger |
52 | 52 | ); |
53 | 53 | }; |
54 | - $initialization = function (AbstractApp $app) use ($context) { |
|
54 | + $initialization = function(AbstractApp $app) use ($context) { |
|
55 | 55 | if ($context === 'prod') { |
56 | 56 | (new ApplicationReflector($app))->compileAllResources(); |
57 | 57 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $cache = function_exists('apc_fetch') ? |
61 | 61 | new FusionCache( |
62 | 62 | new ApcCache, |
63 | - function () use ($tmpDir) { |
|
63 | + function() use ($tmpDir) { |
|
64 | 64 | return new FilesystemCache($tmpDir); |
65 | 65 | } |
66 | 66 | ) |
67 | 67 | : new FilesystemCache($tmpDir); |
68 | - $injector = new CacheInjector($injector, $initialization, $appName . $context, $cache); |
|
68 | + $injector = new CacheInjector($injector, $initialization, $appName.$context, $cache); |
|
69 | 69 | $app = $injector->getInstance('\BEAR\Sunday\Extension\Application\AppInterface'); |
70 | 70 | /* @var $app \BEAR\Sunday\Extension\Application\AppInterface */ |
71 | 71 | return $app; |