Completed
Push — 0.x ( a2b070...a5c73d )
by Akihito
09:21
created
src/Installer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
         $version = $event->getComposer()->getPackage()->getPrettyVersion();
22 22
         $hash = $event->getComposer()->getLocker()->getLockData()['hash'];
23 23
         $packageDir = dirname(__DIR__);
24
-        file_put_contents($packageDir . '/VERSION', $version);
25
-        file_put_contents($packageDir . '/ID', $hash);
24
+        file_put_contents($packageDir.'/VERSION', $version);
25
+        file_put_contents($packageDir.'/ID', $hash);
26 26
 
27
-        $targetHello = dirname(__DIR__) . '/vendor/bear/demo-apps/Demo.Helloworld';
28
-        $targetSandbox = dirname(__DIR__) . '/vendor/bear/demo-apps/Demo.Sandbox';
29
-        $helloApp = dirname(__DIR__) . '/apps/Demo.Helloworld';
30
-        $sandboxApp = dirname(__DIR__) . '/apps/Demo.Sandbox';
27
+        $targetHello = dirname(__DIR__).'/vendor/bear/demo-apps/Demo.Helloworld';
28
+        $targetSandbox = dirname(__DIR__).'/vendor/bear/demo-apps/Demo.Sandbox';
29
+        $helloApp = dirname(__DIR__).'/apps/Demo.Helloworld';
30
+        $sandboxApp = dirname(__DIR__).'/apps/Demo.Sandbox';
31 31
 
32 32
         if (file_exists($helloApp)) {
33 33
             unlink($helloApp);
@@ -38,6 +38,6 @@  discard block
 block discarded – undo
38 38
         symlink($targetHello, $helloApp);
39 39
         symlink($targetSandbox, $sandboxApp);
40 40
 
41
-        include $packageDir . '/bin/bear.env';
41
+        include $packageDir.'/bin/bear.env';
42 42
     }
43 43
 }
Please login to merge, or discard this patch.
src/Dev/Dev.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     ) {
99 99
         global $argv;
100 100
 
101
-        $this->web = $web ? : new Web;
101
+        $this->web = $web ?: new Web;
102 102
         if (is_null($server) && isset($_SERVER)) {
103 103
             $server = $_SERVER;
104 104
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         } elseif (isset($argv[2])) {
108 108
             $this->requestUri = $argv[2];
109 109
         }
110
-        $this->sapiName = $sapiName ? : php_sapi_name();
110
+        $this->sapiName = $sapiName ?: php_sapi_name();
111 111
     }
112 112
 
113 113
     /**
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 
132 132
         // stop
133 133
         register_shutdown_function(
134
-            function () {
134
+            function() {
135 135
                 $xhprof = xhprof_disable();
136 136
                 if (!$xhprof) {
137
-                    error_log('xhprof failed in ' . __FILE__);
137
+                    error_log('xhprof failed in '.__FILE__);
138 138
 
139 139
                     return;
140 140
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         ini_set('xdebug.collect_params', 0);
160 160
         ini_set('xdebug.max_nesting_level', 500);
161 161
         ini_set('xdebug.file_link_format', '/dev/edit/?file=%f&line=$l');
162
-        if (! ini_get('date.timezone')) {
162
+        if (!ini_get('date.timezone')) {
163 163
             date_default_timezone_set('Asia/Tokyo');
164 164
         }
165 165
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function registerErrorHandler()
173 173
     {
174
-        set_error_handler( function ($errNo, $errStr, $errFile, $errLine) {
174
+        set_error_handler(function($errNo, $errStr, $errFile, $errLine) {
175 175
             if (error_reporting() === 0) {
176 176
 
177 177
                 // return in error-control operator(@)
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
     public function registerExceptionHandler($logDir)
209 209
     {
210 210
         set_exception_handler(
211
-            function (\Exception $e) use ($logDir) {
211
+            function(\Exception $e) use ($logDir) {
212 212
                 $handler = new ExceptionHandler(
213 213
                     new SymfonyResponse(new ConsoleOutput),
214
-                    (dirname(__DIR__)) . '/Dev/Module/ExceptionHandle/template/exception.php'
214
+                    (dirname(__DIR__)).'/Dev/Module/ExceptionHandle/template/exception.php'
215 215
                 );
216 216
                 $handler->setLogDir($logDir);
217 217
                 $handler->handle($e);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     public function registerFatalErrorHandler()
251 251
     {
252 252
         register_shutdown_function(
253
-            function () {
253
+            function() {
254 254
                 if (PHP_SAPI === 'cli') {
255 255
                     return;
256 256
                 }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                 $outputBuffer = ob_get_clean();
270 270
                 error_log($outputBuffer);
271 271
                 http_response_code(500);
272
-                $html = require __DIR__ . '/view/fatal_error.php';
272
+                $html = require __DIR__.'/view/fatal_error.php';
273 273
                 echo $html;
274 274
                 exit(1);
275 275
             }
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
         if (isset($this->app->router)) {
303 303
             $this->route($this->app);
304 304
         }
305
-        if (! $this->web->isDevWebService($this->sapiName, $this->requestUri)) {
305
+        if (!$this->web->isDevWebService($this->sapiName, $this->requestUri)) {
306 306
             return '';
307 307
         }
308
-        $requestUri = $requestUri ? : $_SERVER['REQUEST_URI'];
308
+        $requestUri = $requestUri ?: $_SERVER['REQUEST_URI'];
309 309
         $html = $this->web->service($requestUri, $this->app, $this->appDir);
310 310
 
311 311
         return $html;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      */
328 328
     public function loadDevFunctions()
329 329
     {
330
-        error_log(__METHOD__  . ' is no longer necessary.');
330
+        error_log(__METHOD__.' is no longer necessary.');
331 331
 
332 332
         return $this;
333 333
     }
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
      */
357 357
     private function getVendorDirectory()
358 358
     {
359
-        $vendorDir = dirname(dirname(__DIR__)) . '/vendor';
359
+        $vendorDir = dirname(dirname(__DIR__)).'/vendor';
360 360
 
361 361
         if (strpos(__DIR__, '/vendor/bear/package') !== false) {
362 362
             $baseDir = explode('/vendor/bear/package', __DIR__)[0];
363
-            $vendorDir = $baseDir . '/vendor';
363
+            $vendorDir = $baseDir.'/vendor';
364 364
         }
365 365
         return $vendorDir;
366 366
     }
Please login to merge, or discard this patch.
src/Dev/Debug/Debug.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Dev/Debug/ExceptionHandle/Screen.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Dev/Debug/ExceptionHandle/ExceptionHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Dev/Application/ApplicationReflector.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/Dev/Module/ExceptionHandle/ExceptionHandleModule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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')
Please login to merge, or discard this patch.
src/Dev/Resource/ResourceLog.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Dev/Web/Editor/FileTree.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.