@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -28,9 +28,9 @@ |
||
28 | 28 | public function reverseMap($httpHost, $internalUri) |
29 | 29 | { |
30 | 30 | $parsedUrl = parse_url($internalUri); |
31 | - $uri = $httpHost . "/{$parsedUrl['scheme']}{$parsedUrl['path']}/"; |
|
31 | + $uri = $httpHost."/{$parsedUrl['scheme']}{$parsedUrl['path']}/"; |
|
32 | 32 | if (isset($parsedUrl['query'])) { |
33 | - $uri .= '?' . $parsedUrl['query']; |
|
33 | + $uri .= '?'.$parsedUrl['query']; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | return $uri; |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $this->valuateElements($ro); |
49 | 49 | } |
50 | 50 | // HAL |
51 | - $data = $ro->body ? : []; |
|
51 | + $data = $ro->body ?: []; |
|
52 | 52 | if (is_scalar($data)) { |
53 | 53 | $data = ['value' => $data]; |
54 | 54 | } |
55 | 55 | $hal = $this->halFactory->get($ro, $data); |
56 | - $ro->view = $hal->asJson(true) . PHP_EOL; |
|
56 | + $ro->view = $hal->asJson(true).PHP_EOL; |
|
57 | 57 | $ro->headers['content-type'] = 'application/hal+json; charset=UTF-8'; |
58 | 58 | |
59 | 59 | return $ro->view; |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @param \BEAR\Resource\ResourceObject $ro |
64 | 64 | */ |
65 | - private function valuateElements(ResourceObject &$ro) |
|
65 | + private function valuateElements(ResourceObject & $ro) |
|
66 | 66 | { |
67 | 67 | array_walk_recursive( |
68 | 68 | $ro->body, |
69 | - function (&$element) { |
|
69 | + function(&$element) { |
|
70 | 70 | if ($element instanceof RequestInterface) { |
71 | 71 | /** @var $element callable */ |
72 | 72 | $element = $element(); |