@@ -46,27 +46,27 @@ discard block |
||
| 46 | 46 | $statusText = '' |
| 47 | 47 | ) { |
| 48 | 48 | // code |
| 49 | - $output = self::LABEL . $resource->code . ' ' . $statusText . self::CLOSE . PHP_EOL; |
|
| 49 | + $output = self::LABEL.$resource->code.' '.$statusText.self::CLOSE.PHP_EOL; |
|
| 50 | 50 | // resource headers |
| 51 | 51 | $header = $this->getHeader($resource); |
| 52 | 52 | // body |
| 53 | 53 | $output .= $header; |
| 54 | - $output .= self::LABEL . '[BODY]' . self::CLOSE . PHP_EOL; |
|
| 54 | + $output .= self::LABEL.'[BODY]'.self::CLOSE.PHP_EOL; |
|
| 55 | 55 | if (is_scalar($resource->body)) { |
| 56 | 56 | $output .= (string) $resource->body; |
| 57 | 57 | goto COMPLETE; |
| 58 | 58 | } |
| 59 | 59 | $isTraversable = is_array($resource->body) || $resource->body instanceof \Traversable; |
| 60 | - $body = $isTraversable ? $this->getBody($resource) : '*'. gettype($resource->body); |
|
| 60 | + $body = $isTraversable ? $this->getBody($resource) : '*'.gettype($resource->body); |
|
| 61 | 61 | $output .= $body; |
| 62 | 62 | if ($resource->view) { |
| 63 | - $output .= PHP_EOL . self::LABEL . '[VIEW]' . self::CLOSE . PHP_EOL . $resource->view; |
|
| 63 | + $output .= PHP_EOL.self::LABEL.'[VIEW]'.self::CLOSE.PHP_EOL.$resource->view; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | COMPLETE: |
| 67 | 67 | if ($this->enableOutput) { |
| 68 | 68 | // @codeCoverageIgnoreStart |
| 69 | - echo $output . PHP_EOL; |
|
| 69 | + echo $output.PHP_EOL; |
|
| 70 | 70 | } |
| 71 | 71 | // @codeCoverageIgnoreEnd |
| 72 | 72 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $header = ''; |
| 85 | 85 | foreach ($resource->headers as $name => $value) { |
| 86 | 86 | $value = (is_array($value)) ? json_encode($value, true) : $value; |
| 87 | - $header .= self::LABEL1 . "{$name}: " . self::CLOSE . "{$value}" . PHP_EOL; |
|
| 87 | + $header .= self::LABEL1."{$name}: ".self::CLOSE."{$value}".PHP_EOL; |
|
| 88 | 88 | } |
| 89 | 89 | return $header; |
| 90 | 90 | } |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | $string .= $header; |
| 116 | 116 | |
| 117 | 117 | foreach ($target as $key => $body) { |
| 118 | - $string .= str_repeat(' ', $level) . |
|
| 119 | - self::LABEL1 . $key . self::CLOSE . ' ' . |
|
| 118 | + $string .= str_repeat(' ', $level). |
|
| 119 | + self::LABEL1.$key.self::CLOSE.' '. |
|
| 120 | 120 | $this->getVarDump( |
| 121 | 121 | $body, |
| 122 | 122 | $level + 1, |
| 123 | - '=> array(' . PHP_EOL, |
|
| 124 | - str_repeat(' ', $level) . ')' |
|
| 125 | - ) . |
|
| 126 | - ',' . PHP_EOL; |
|
| 123 | + '=> array('.PHP_EOL, |
|
| 124 | + str_repeat(' ', $level).')' |
|
| 125 | + ). |
|
| 126 | + ','.PHP_EOL; |
|
| 127 | 127 | } |
| 128 | 128 | $string .= $footer; |
| 129 | 129 | |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | $string .= $this->getVarDump( |
| 140 | 140 | get_object_vars($target), |
| 141 | 141 | $level, |
| 142 | - '=> ' . get_class($target) . '(' . PHP_EOL, |
|
| 143 | - str_repeat(' ', $level - 1) . ')' |
|
| 142 | + '=> '.get_class($target).'('.PHP_EOL, |
|
| 143 | + str_repeat(' ', $level - 1).')' |
|
| 144 | 144 | ); |
| 145 | 145 | |
| 146 | 146 | return $string; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | private function getRequestString(Request $request) |
| 159 | 159 | { |
| 160 | - $body = self::LABEL2 . $request->toUri() . self::CLOSE; |
|
| 160 | + $body = self::LABEL2.$request->toUri().self::CLOSE; |
|
| 161 | 161 | return $body; |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $this |
| 20 | 20 | ->bind('BEAR\Sunday\Extension\ConsoleOutput\ConsoleOutputInterface') |
| 21 | - ->to(__NAMESPACE__ . '\ConsoleOutput') |
|
| 21 | + ->to(__NAMESPACE__.'\ConsoleOutput') |
|
| 22 | 22 | ->in(Scope::SINGLETON); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | */ |
| 78 | 78 | public function match() |
| 79 | 79 | { |
| 80 | - $globals = $this->globals ? : $GLOBALS; |
|
| 80 | + $globals = $this->globals ?: $GLOBALS; |
|
| 81 | 81 | return $this->router->match($globals['_SERVER']['REQUEST_URI'], $globals); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -28,14 +28,14 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function log(BoundDefinition $definition, array $params, array $setter, $object, Bind $bind) |
| 30 | 30 | { |
| 31 | - $toStr = function ($params) { |
|
| 31 | + $toStr = function($params) { |
|
| 32 | 32 | foreach ($params as &$param) { |
| 33 | 33 | if (is_object($param)) { |
| 34 | - $param = get_class($param) . '#' . spl_object_hash($param); |
|
| 34 | + $param = get_class($param).'#'.spl_object_hash($param); |
|
| 35 | 35 | } elseif (is_callable($param)) { |
| 36 | 36 | $param = "(callable) {$param}"; |
| 37 | 37 | } elseif (is_scalar($param)) { |
| 38 | - $param = '(' . gettype($param) . ') ' . (string) $param; |
|
| 38 | + $param = '('.gettype($param).') '.(string) $param; |
|
| 39 | 39 | } elseif (is_array($param)) { |
| 40 | 40 | $param = $str = str_replace(["\n", " "], '', print_r($param, true)); |
| 41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | }; |
| 45 | 45 | $constructor = $toStr($params); |
| 46 | 46 | $constructor = $constructor ? $constructor : ''; |
| 47 | - $setter = $setter ? "setter[" . implode(', ', array_keys($setter)) . ']' : ''; |
|
| 47 | + $setter = $setter ? "setter[".implode(', ', array_keys($setter)).']' : ''; |
|
| 48 | 48 | $logMessage = "[DI] {$definition->class} construct[$constructor] {$setter}"; |
| 49 | 49 | $this->logMessages[] = $logMessage; |
| 50 | 50 | } |
@@ -53,9 +53,8 @@ |
||
| 53 | 53 | |
| 54 | 54 | return (string) $resourceObject->body; |
| 55 | 55 | } |
| 56 | - $file = ($resourceObject instanceof WeavedInterface) ? |
|
| 57 | - (new ReflectionClass($resourceObject))->getParentClass()->getFileName() : |
|
| 58 | - (new ReflectionClass($resourceObject))->getFileName(); |
|
| 56 | + $file = ($resourceObject instanceof WeavedInterface) ? |
|
| 57 | + (new ReflectionClass($resourceObject))->getParentClass()->getFileName() : (new ReflectionClass($resourceObject))->getFileName(); |
|
| 59 | 58 | |
| 60 | 59 | // assign 'resource' |
| 61 | 60 | $this->templateEngineAdapter->assign('resource', $resourceObject); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if (is_array($ro->body) || $ro->body instanceof \Traversable) { |
| 23 | 23 | array_walk_recursive( |
| 24 | 24 | $ro->body, |
| 25 | - function (&$element) { |
|
| 25 | + function(&$element) { |
|
| 26 | 26 | if ($element instanceof RequestInterface) { |
| 27 | 27 | /** @var $element callable */ |
| 28 | 28 | $element = $element(); |
@@ -20,8 +20,8 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | protected function configure() |
| 22 | 22 | { |
| 23 | - $this->bind('BEAR\Resource\RenderInterface')->to(__NAMESPACE__ . '\HalRenderer')->in(Scope::SINGLETON); |
|
| 24 | - $this->bind('BEAR\Package\Provide\ResourceView\HalFactoryInterface')->to(__NAMESPACE__ . '\HalFactory'); |
|
| 25 | - $this->bind('BEAR\Package\Provide\ResourceView\UriMapperInterface')->to(__NAMESPACE__ . '\SchemeUriMapper'); |
|
| 23 | + $this->bind('BEAR\Resource\RenderInterface')->to(__NAMESPACE__.'\HalRenderer')->in(Scope::SINGLETON); |
|
| 24 | + $this->bind('BEAR\Package\Provide\ResourceView\HalFactoryInterface')->to(__NAMESPACE__.'\HalFactory'); |
|
| 25 | + $this->bind('BEAR\Package\Provide\ResourceView\UriMapperInterface')->to(__NAMESPACE__.'\SchemeUriMapper'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->templateEngineAdapter->assignAll($resourceObject->body); |
| 182 | 182 | } |
| 183 | 183 | // rendering with original render |
| 184 | - $view = $this->templateEngineRenderer->render($resourceObject); |
|
| 184 | + $view = $this->templateEngineRenderer->render($resourceObject); |
|
| 185 | 185 | |
| 186 | 186 | // add tool bar |
| 187 | 187 | $resourceObject->view = $view; |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | private function addResourceMetaInfo(ResourceObject $resourceObject, $labelColor, $templateFile, $body) |
| 275 | 275 | { |
| 276 | - $resourceName = ($resourceObject->uri ? : get_class($resourceObject)); |
|
| 276 | + $resourceName = ($resourceObject->uri ?: get_class($resourceObject)); |
|
| 277 | 277 | // code editor |
| 278 | 278 | $ref = new ReflectionObject($resourceObject); |
| 279 | - $codeFile = ($resourceObject instanceof WeavedInterface) ? $ref->getParentClass()->getFileName(): $ref->getFileName(); |
|
| 279 | + $codeFile = ($resourceObject instanceof WeavedInterface) ? $ref->getParentClass()->getFileName() : $ref->getFileName(); |
|
| 280 | 280 | $codeFile = $this->makeRelativePath($codeFile); |
| 281 | 281 | $var = $this->getVar($resourceObject->body); |
| 282 | 282 | $resourceKey = spl_object_hash($resourceObject); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $resourceBody = preg_replace_callback( |
| 286 | 286 | '/<!-- resource(.*?)resource_tab_end -->/s', |
| 287 | - function ($matches) { |
|
| 287 | + function($matches) { |
|
| 288 | 288 | $uri = substr(explode(' ', $matches[1])[0], 1); |
| 289 | 289 | preg_match('/ <!-- resource_body_start -->(.*?)<!-- resource_body_end -->/s', $matches[1], $resourceBodyMatch); |
| 290 | 290 | return "<!-- resource:$uri -->{$resourceBodyMatch[1]}<!-- /resource:$uri -->"; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | ); |
| 294 | 294 | $resourceBodyHtml = highlight_string($resourceBody, true); |
| 295 | 295 | $info = $this->getResourceInfo($resourceObject); |
| 296 | - $rmReturn = function ($str) { |
|
| 296 | + $rmReturn = function($str) { |
|
| 297 | 297 | return str_replace("\n", '', $str); |
| 298 | 298 | }; |
| 299 | 299 | $result = <<<EOT |
@@ -369,16 +369,16 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | array_walk_recursive( |
| 371 | 371 | $body, |
| 372 | - function (&$value) { |
|
| 372 | + function(&$value) { |
|
| 373 | 373 | if ($value instanceof Request) { |
| 374 | - $value = '(Request)' . $value->toUri(); |
|
| 374 | + $value = '(Request)'.$value->toUri(); |
|
| 375 | 375 | } |
| 376 | 376 | if ($value instanceof ResourceObject) { |
| 377 | 377 | $value = $value->body; |
| 378 | 378 | } |
| 379 | 379 | if (is_object($value)) { |
| 380 | 380 | /** @var $value object */ |
| 381 | - $value = '(object) ' . get_class($value); |
|
| 381 | + $value = '(object) '.get_class($value); |
|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | ); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | private function getParamsInfo(ResourceObject $resourceObject) |
| 415 | 415 | { |
| 416 | - $result = self::BADGE_ARGS . self::DIV_WELL; |
|
| 416 | + $result = self::BADGE_ARGS.self::DIV_WELL; |
|
| 417 | 417 | if (isset($resourceObject->headers[DevInvoker::HEADER_PARAMS])) { |
| 418 | 418 | $params = json_decode($resourceObject->headers[DevInvoker::HEADER_PARAMS], true); |
| 419 | 419 | } else { |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | /** @noinspection PhpUndefinedVariableInspection */ |
| 442 | 442 | $result .= "<ul>{$paramInfo}</ul>"; |
| 443 | 443 | |
| 444 | - return $result . '</div>'; |
|
| 444 | + return $result.'</div>'; |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | /** |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | private function getInterceptorInfo(ResourceObject $resourceObject) |
| 455 | 455 | { |
| 456 | - $result = self::BADGE_INTERCEPTORS . self::DIV_WELL; |
|
| 456 | + $result = self::BADGE_INTERCEPTORS.self::DIV_WELL; |
|
| 457 | 457 | if (!isset($resourceObject->headers[DevInvoker::HEADER_INTERCEPTORS])) { |
| 458 | - return $result . 'n/a</div>'; |
|
| 458 | + return $result.'n/a</div>'; |
|
| 459 | 459 | } |
| 460 | 460 | $result .= '<ul class="unstyled">'; |
| 461 | 461 | $interceptors = json_decode($resourceObject->headers[DevInvoker::HEADER_INTERCEPTORS], true); |
@@ -486,9 +486,9 @@ discard block |
||
| 486 | 486 | $resourceObject->headers[CacheLoader::HEADER_CACHE], |
| 487 | 487 | true |
| 488 | 488 | ) : false; |
| 489 | - $result = self::BADGE_CACHE . self::DIV_WELL; |
|
| 489 | + $result = self::BADGE_CACHE.self::DIV_WELL; |
|
| 490 | 490 | if ($cache === false) { |
| 491 | - return $result . 'n/a</div>'; |
|
| 491 | + return $result.'n/a</div>'; |
|
| 492 | 492 | } |
| 493 | 493 | $iconLife = self::ICON_LIFE; |
| 494 | 494 | $iconTime = self::ICON_TIME; |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | $result .= "Read {$iconLife} {$life} {$iconTime} {$time}"; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - return $result . '</div>'; |
|
| 511 | + return $result.'</div>'; |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | /** |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | private function getProfileInfo(ResourceObject $resourceObject) |
| 522 | 522 | { |
| 523 | 523 | // memory, time |
| 524 | - $result = self::BADGE_PROFILE . self::DIV_WELL; |
|
| 524 | + $result = self::BADGE_PROFILE.self::DIV_WELL; |
|
| 525 | 525 | if (isset($resourceObject->headers[DevInvoker::HEADER_EXECUTION_TIME])) { |
| 526 | 526 | $time = number_format($resourceObject->headers[DevInvoker::HEADER_EXECUTION_TIME], 3); |
| 527 | 527 | } else { |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | protected function configure() |
| 17 | 17 | { |
| 18 | - $this->bind('BEAR\Resource\RenderInterface')->to(__NAMESPACE__ . '\TemplateEngineRenderer'); |
|
| 18 | + $this->bind('BEAR\Resource\RenderInterface')->to(__NAMESPACE__.'\TemplateEngineRenderer'); |
|
| 19 | 19 | } |
| 20 | 20 | } |