@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | public function render(ResourceObject $ro) |
| 48 | 48 | { |
| 49 | 49 | list($ro, $body) = $this->valuate($ro); |
| 50 | - $method = 'on' . ucfirst($ro->uri->method); |
|
| 50 | + $method = 'on'.ucfirst($ro->uri->method); |
|
| 51 | 51 | $hasMethod = method_exists($ro, $method); |
| 52 | - if (! $hasMethod) { |
|
| 52 | + if (!$hasMethod) { |
|
| 53 | 53 | $ro->view = ''; // OPTIONS request no view |
| 54 | 54 | |
| 55 | 55 | return ''; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | /* @var $annotations Link[] */ |
| 59 | 59 | /* @var $ro ResourceObject */ |
| 60 | 60 | $hal = $this->getHal($ro->uri, $body, $annotations); |
| 61 | - $ro->view = $hal->asJson(true) . PHP_EOL; |
|
| 61 | + $ro->view = $hal->asJson(true).PHP_EOL; |
|
| 62 | 62 | $this->updateHeaders($ro); |
| 63 | 63 | |
| 64 | 64 | return $ro->view; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * @param \BEAR\Resource\ResourceObject $ro |
| 69 | 69 | */ |
| 70 | - private function valuateElements(ResourceObject &$ro) |
|
| 70 | + private function valuateElements(ResourceObject & $ro) |
|
| 71 | 71 | { |
| 72 | 72 | foreach ($ro->body as $key => &$element) { |
| 73 | 73 | if ($element instanceof RequestInterface) { |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private function getHal(AbstractUri $uri, array $body, array $annotations) |
| 89 | 89 | { |
| 90 | - $query = $uri->query ? '?' . http_build_query($uri->query) : ''; |
|
| 91 | - $path = $uri->path . $query; |
|
| 90 | + $query = $uri->query ? '?'.http_build_query($uri->query) : ''; |
|
| 91 | + $path = $uri->path.$query; |
|
| 92 | 92 | $selfLink = $this->getReverseMatchedLink($path); |
| 93 | 93 | $hal = new Hal($selfLink, $body); |
| 94 | 94 | $this->getHalLink($body, $annotations, $hal); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | private function getHalLink(array $body, array $links, Hal $hal) |
| 150 | 150 | { |
| 151 | 151 | foreach ($links as $link) { |
| 152 | - if (! $link instanceof Link) { |
|
| 152 | + if (!$link instanceof Link) { |
|
| 153 | 153 | continue; |
| 154 | 154 | } |
| 155 | 155 | $uri = uri_template($link->href, $body); |
@@ -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 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function __construct(AbstractAppMeta $appMeta, TransferInterface $responder) |
| 62 | 62 | { |
| 63 | 63 | $this->logDir = $appMeta->logDir; |
| 64 | - $this->lastErrorFile = $this->logDir . '/last_error.log'; |
|
| 64 | + $this->lastErrorFile = $this->logDir.'/last_error.log'; |
|
| 65 | 65 | $this->responder = $responder; |
| 66 | 66 | $this->exceptionString = new ExceptionAsString; |
| 67 | 67 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | private function codeError(\Exception $e) |
| 122 | 122 | { |
| 123 | 123 | $code = $e->getCode(); |
| 124 | - $message = $code . ' ' . (new Code)->statusText[$code]; |
|
| 124 | + $message = $code.' '.(new Code)->statusText[$code]; |
|
| 125 | 125 | $body = ['message' => $message]; |
| 126 | 126 | |
| 127 | 127 | return [$code, $body]; |
@@ -153,6 +153,6 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | private function getLogRefId(\Exception $e) |
| 155 | 155 | { |
| 156 | - return (string) crc32(get_class($e) . $e->getMessage() . $e->getFile() . $e->getLine()); |
|
| 156 | + return (string) crc32(get_class($e).$e->getMessage().$e->getFile().$e->getLine()); |
|
| 157 | 157 | } |
| 158 | 158 | } |
@@ -24,6 +24,6 @@ |
||
| 24 | 24 | { |
| 25 | 25 | $string = parent::__toString(); |
| 26 | 26 | |
| 27 | - return $string . $this->postBody; |
|
| 27 | + return $string.$this->postBody; |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -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 | } |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function get() |
| 29 | 29 | { |
| 30 | - return new FilesystemCache($this->app->tmpDir . '/cache'); |
|
| 30 | + return new FilesystemCache($this->app->tmpDir.'/cache'); |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -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 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function newApp(AbstractAppMeta $appMeta, $contexts, Cache $cache = null) |
| 46 | 46 | { |
| 47 | 47 | $cache = $cache ?: $this->getCache($appMeta, $contexts); |
| 48 | - $appId = $appMeta->name . $contexts; |
|
| 48 | + $appId = $appMeta->name.$contexts; |
|
| 49 | 49 | $isProd = is_int(strpos($contexts, 'prod')); |
| 50 | 50 | $app = $cache->fetch($appId); |
| 51 | 51 | if ($app && $isProd) { |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | $contextsArray = array_reverse(explode('-', $contexts)); |
| 92 | 92 | $module = null; |
| 93 | 93 | foreach ($contextsArray as $context) { |
| 94 | - $class = $appMeta->name . '\Module\\' . ucwords($context) . 'Module'; |
|
| 94 | + $class = $appMeta->name.'\Module\\'.ucwords($context).'Module'; |
|
| 95 | 95 | if (!class_exists($class)) { |
| 96 | - $class = 'BEAR\Package\Context\\' . ucwords($context) . 'Module'; |
|
| 96 | + $class = 'BEAR\Package\Context\\'.ucwords($context).'Module'; |
|
| 97 | 97 | } |
| 98 | - if (! is_a($class, AbstractModule::class, true)) { |
|
| 98 | + if (!is_a($class, AbstractModule::class, true)) { |
|
| 99 | 99 | throw new InvalidContextException($class); |
| 100 | 100 | } |
| 101 | 101 | /* @var $module AbstractModule */ |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | private function getParams($method, array $server, array $post) |
| 112 | 112 | { |
| 113 | 113 | // post data exists |
| 114 | - if ($method === 'post' && ! empty($post)) { |
|
| 114 | + if ($method === 'post' && !empty($post)) { |
|
| 115 | 115 | return $post; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | private function phpInput(array $server) |
| 133 | 133 | { |
| 134 | 134 | $contentType = $this->getContentType($server); |
| 135 | - if (! $contentType) { |
|
| 135 | + if (!$contentType) { |
|
| 136 | 136 | return []; |
| 137 | 137 | } |
| 138 | 138 | $isFormUrlEncoded = strpos($contentType, self::FORM_URL_ENCODE) !== false; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | $isApplicationJson = strpos($contentType, self::APPLICATION_JSON) !== false; |
| 145 | 145 | if ($isApplicationJson) { |
| 146 | - $content = json_decode(file_get_contents($this->stdIn), true); |
|
| 146 | + $content = json_decode(file_get_contents($this->stdIn), true); |
|
| 147 | 147 | |
| 148 | 148 | return $content; |
| 149 | 149 | } |