@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | $request = new RouterMatch; |
43 | 43 | list($request->method, $request->query) = $this->httpMethodParams->get($server, $globals['_GET'], $globals['_POST']); |
44 | - $request->path = $this->schemeHost . parse_url($server['REQUEST_URI'], PHP_URL_PATH); |
|
44 | + $request->path = $this->schemeHost.parse_url($server['REQUEST_URI'], PHP_URL_PATH); |
|
45 | 45 | |
46 | 46 | return $request; |
47 | 47 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | protected function configure() |
30 | 30 | { |
31 | 31 | $this->bind(AbstractAppMeta::class)->toInstance($this->appMeta); |
32 | - $this->bind(AppInterface::class)->to($this->appMeta->name . '\Module\App'); |
|
32 | + $this->bind(AppInterface::class)->to($this->appMeta->name.'\Module\App'); |
|
33 | 33 | $this->bind('')->annotatedWith(AppName::class)->toInstance($this->appMeta->name); |
34 | 34 | } |
35 | 35 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $this->rename(RouterInterface::class, 'original'); |
24 | 24 | $this->bind(RouterInterface::class)->to(CliRouter::class); |
25 | 25 | $this->bind(TransferInterface::class)->to(CliResponder::class); |
26 | - $stdIn = tempnam(sys_get_temp_dir(), 'stdin-' . crc32(__FILE__)); |
|
26 | + $stdIn = tempnam(sys_get_temp_dir(), 'stdin-'.crc32(__FILE__)); |
|
27 | 27 | $this->bind()->annotatedWith(StdIn::class)->toInstance($stdIn); |
28 | 28 | } |
29 | 29 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function getParams($method, array $server, array $post) |
111 | 111 | { |
112 | 112 | // post data exists |
113 | - if ($method === 'post' && ! empty($post)) { |
|
113 | + if ($method === 'post' && !empty($post)) { |
|
114 | 114 | return $post; |
115 | 115 | } |
116 | 116 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | private function phpInput(array $server) |
132 | 132 | { |
133 | 133 | $contentType = $this->getContentType($server); |
134 | - if (! $contentType) { |
|
134 | + if (!$contentType) { |
|
135 | 135 | return []; |
136 | 136 | } |
137 | 137 | $isFormUrlEncoded = strpos($contentType, self::FORM_URL_ENCODE) !== false; |
@@ -83,11 +83,11 @@ |
||
83 | 83 | $contextsArray = array_reverse(explode('-', $contexts)); |
84 | 84 | $module = null; |
85 | 85 | foreach ($contextsArray as $context) { |
86 | - $class = $appMeta->name . '\Module\\' . ucwords($context) . 'Module'; |
|
87 | - if (! class_exists($class)) { |
|
88 | - $class = 'BEAR\Package\Context\\' . ucwords($context) . 'Module'; |
|
86 | + $class = $appMeta->name.'\Module\\'.ucwords($context).'Module'; |
|
87 | + if (!class_exists($class)) { |
|
88 | + $class = 'BEAR\Package\Context\\'.ucwords($context).'Module'; |
|
89 | 89 | } |
90 | - if (! is_a($class, AbstractModule::class, true)) { |
|
90 | + if (!is_a($class, AbstractModule::class, true)) { |
|
91 | 91 | throw new InvalidContextException($class); |
92 | 92 | } |
93 | 93 | /* @var $module AbstractModule */ |
@@ -29,6 +29,10 @@ |
||
29 | 29 | */ |
30 | 30 | private $appMeta; |
31 | 31 | |
32 | + /** |
|
33 | + * @param string $name |
|
34 | + * @param string $contexts |
|
35 | + */ |
|
32 | 36 | public function __construct($name, $contexts) |
33 | 37 | { |
34 | 38 | $this->appMeta = new AppMeta($name, $contexts); |
@@ -18,21 +18,21 @@ |
||
18 | 18 | public function __invoke(ResourceObject $resourceObject, array $server) |
19 | 19 | { |
20 | 20 | unset($server); |
21 | - if (! $resourceObject->view) { |
|
21 | + if (!$resourceObject->view) { |
|
22 | 22 | $resourceObject->toString(); |
23 | 23 | } |
24 | 24 | // code |
25 | 25 | $statusText = (new Code)->statusText[$resourceObject->code]; |
26 | - $ob = $resourceObject->code . ' ' . $statusText . PHP_EOL; |
|
26 | + $ob = $resourceObject->code.' '.$statusText.PHP_EOL; |
|
27 | 27 | // header |
28 | 28 | foreach ($resourceObject->headers as $label => $value) { |
29 | - $ob .= "{$label}: {$value}" . PHP_EOL; |
|
29 | + $ob .= "{$label}: {$value}".PHP_EOL; |
|
30 | 30 | } |
31 | 31 | // empty line |
32 | 32 | $ob .= PHP_EOL; |
33 | 33 | // body |
34 | 34 | $ob .= $resourceObject->view; |
35 | 35 | |
36 | - echo $ob . PHP_EOL; |
|
36 | + echo $ob.PHP_EOL; |
|
37 | 37 | } |
38 | 38 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | /** |
132 | 132 | * @param string $uri |
133 | 133 | * |
134 | - * @return mixed |
|
134 | + * @return string |
|
135 | 135 | */ |
136 | 136 | private function getReverseMatchedLink($uri) |
137 | 137 | { |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function render(ResourceObject $ro) |
64 | 64 | { |
65 | - $method = 'on' . ucfirst($ro->uri->method); |
|
65 | + $method = 'on'.ucfirst($ro->uri->method); |
|
66 | 66 | $hasMethod = method_exists($ro, $method); |
67 | - if (! $hasMethod) { |
|
67 | + if (!$hasMethod) { |
|
68 | 68 | $ro->view = ''; // OPTIONS request no view |
69 | 69 | |
70 | 70 | return ''; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /* @var $annotations Link[] */ |
82 | 82 | /* @var $ro ResourceObject */ |
83 | 83 | $hal = $this->getHal($ro->uri, $body, $annotations); |
84 | - $ro->view = $hal->asJson(true) . PHP_EOL; |
|
84 | + $ro->view = $hal->asJson(true).PHP_EOL; |
|
85 | 85 | $this->updateHeaders($ro); |
86 | 86 | |
87 | 87 | return $ro->view; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @param \BEAR\Resource\ResourceObject $ro |
106 | 106 | */ |
107 | - private function valuateElements(ResourceObject &$ro) |
|
107 | + private function valuateElements(ResourceObject & $ro) |
|
108 | 108 | { |
109 | 109 | foreach ($ro->body as $key => &$embeded) { |
110 | 110 | if ($embeded instanceof AbstractRequest) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | private function isDifferentSchema(ResourceObject $parentRo, ResourceObject $childRo) |
133 | 133 | { |
134 | - return $parentRo->uri->host . $parentRo->uri->host !== $childRo->uri->scheme . $childRo->uri->host; |
|
134 | + return $parentRo->uri->host.$parentRo->uri->host !== $childRo->uri->scheme.$childRo->uri->host; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function getHal(AbstractUri $uri, array $body, array $annotations) |
145 | 145 | { |
146 | - $query = $uri->query ? '?' . http_build_query($uri->query) : ''; |
|
147 | - $path = $uri->path . $query; |
|
146 | + $query = $uri->query ? '?'.http_build_query($uri->query) : ''; |
|
147 | + $path = $uri->path.$query; |
|
148 | 148 | $selfLink = $this->getReverseMatchedLink($path); |
149 | 149 | |
150 | 150 | $hal = new Hal($selfLink, $body); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $hal->addCurie($this->curies->name, $this->curies->href); |
210 | 210 | } |
211 | 211 | foreach ($methodAnnotations as $annotation) { |
212 | - if (! $annotation instanceof Link) { |
|
212 | + if (!$annotation instanceof Link) { |
|
213 | 213 | continue; |
214 | 214 | } |
215 | 215 | $uri = uri_template($annotation->href, $body); |
@@ -28,6 +28,6 @@ |
||
28 | 28 | |
29 | 29 | public function get() |
30 | 30 | { |
31 | - return new Logger($this->appMeta->name, [new StreamHandler($this->appMeta->logDir . '/app.log', Logger::DEBUG)]); |
|
31 | + return new Logger($this->appMeta->name, [new StreamHandler($this->appMeta->logDir.'/app.log', Logger::DEBUG)]); |
|
32 | 32 | } |
33 | 33 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function __construct(\Exception $e) |
25 | 25 | { |
26 | - $this->ref = (string) hash('crc32b', get_class($e) . $e->getMessage() . $e->getFile() . $e->getLine()); |
|
26 | + $this->ref = (string) hash('crc32b', get_class($e).$e->getMessage().$e->getFile().$e->getLine()); |
|
27 | 27 | $this->exceptionString = new ExceptionAsString; |
28 | 28 | } |
29 | 29 |