@@ -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 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function getParams($method, array $server, array $post) : array |
90 | 90 | { |
91 | 91 | // post data exists |
92 | - if ($method === 'post' && ! empty($post)) { |
|
92 | + if ($method === 'post' && !empty($post)) { |
|
93 | 93 | return $post; |
94 | 94 | } |
95 | 95 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return $put; |
114 | 114 | } |
115 | 115 | $isApplicationJson = strpos($contentType, self::APPLICATION_JSON) !== false; |
116 | - if (! $isApplicationJson) { |
|
116 | + if (!$isApplicationJson) { |
|
117 | 117 | return []; |
118 | 118 | } |
119 | 119 | $content = json_decode(file_get_contents($this->stdIn), true); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function __construct(\Exception $e) |
20 | 20 | { |
21 | - $this->ref = hash('crc32b', \get_class($e) . $e->getMessage() . $e->getFile() . $e->getLine()); |
|
21 | + $this->ref = hash('crc32b', \get_class($e).$e->getMessage().$e->getFile().$e->getLine()); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function __toString() |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if ($ro->view) { |
44 | 44 | return $ro->view; |
45 | 45 | } |
46 | - $method = 'on' . ucfirst($ro->uri->method); |
|
46 | + $method = 'on'.ucfirst($ro->uri->method); |
|
47 | 47 | $annotations = $this->reader->getMethodAnnotations(new \ReflectionMethod($ro, $method)); |
48 | 48 | |
49 | 49 | return $this->renderHal($ro, $annotations); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /* @var $annotations Link[] */ |
56 | 56 | /* @var $ro ResourceObject */ |
57 | 57 | $hal = $this->getHal($ro->uri, $body, $annotations); |
58 | - $ro->view = $hal->asJson(true) . PHP_EOL; |
|
58 | + $ro->view = $hal->asJson(true).PHP_EOL; |
|
59 | 59 | $this->updateHeaders($ro); |
60 | 60 | |
61 | 61 | return $ro->view; |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | */ |
84 | 84 | private function isDifferentSchema(ResourceObject $parentRo, ResourceObject $childRo) : bool |
85 | 85 | { |
86 | - return $parentRo->uri->scheme . $parentRo->uri->host !== $childRo->uri->scheme . $childRo->uri->host; |
|
86 | + return $parentRo->uri->scheme.$parentRo->uri->host !== $childRo->uri->scheme.$childRo->uri->host; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | private function getHal(AbstractUri $uri, array $body, array $annotations) : Hal |
90 | 90 | { |
91 | - $query = $uri->query ? '?' . http_build_query($uri->query) : ''; |
|
92 | - $path = $uri->path . $query; |
|
91 | + $query = $uri->query ? '?'.http_build_query($uri->query) : ''; |
|
92 | + $path = $uri->path.$query; |
|
93 | 93 | $selfLink = $this->link->getReverseLink($path); |
94 | 94 | |
95 | 95 | $hal = new Hal($selfLink, $body); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function __construct(AbstractAppMeta $appMeta, string $namespace) |
32 | 32 | { |
33 | - $this->cacheDir = $appMeta->tmpDir . '/cache'; |
|
33 | + $this->cacheDir = $appMeta->tmpDir.'/cache'; |
|
34 | 34 | $this->namespace = $namespace; |
35 | 35 | } |
36 | 36 |
@@ -20,11 +20,11 @@ |
||
20 | 20 | $contextsArray = array_reverse(explode('-', $context)); |
21 | 21 | $module = null; |
22 | 22 | foreach ($contextsArray as $context) { |
23 | - $class = $appMeta->name . '\Module\\' . ucwords($context) . 'Module'; |
|
24 | - if (! class_exists($class)) { |
|
25 | - $class = 'BEAR\Package\Context\\' . ucwords($context) . 'Module'; |
|
23 | + $class = $appMeta->name.'\Module\\'.ucwords($context).'Module'; |
|
24 | + if (!class_exists($class)) { |
|
25 | + $class = 'BEAR\Package\Context\\'.ucwords($context).'Module'; |
|
26 | 26 | } |
27 | - if (! is_a($class, AbstractModule::class, true)) { |
|
27 | + if (!is_a($class, AbstractModule::class, true)) { |
|
28 | 28 | throw new InvalidContextException($class); |
29 | 29 | } |
30 | 30 | /* @var $module AbstractModule */ |
@@ -6,7 +6,6 @@ |
||
6 | 6 | */ |
7 | 7 | namespace BEAR\Package; |
8 | 8 | |
9 | -use BEAR\Accept\Module\App; |
|
10 | 9 | use BEAR\AppMeta\AbstractAppMeta; |
11 | 10 | use BEAR\AppMeta\Meta; |
12 | 11 | use Doctrine\Common\Cache\FilesystemCache; |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | $this->context = $context; |
55 | 55 | $this->appMeta = $appMeta instanceof AbstractAppMeta ? $appMeta : new Meta($name, $context); |
56 | 56 | $this->cacheSpace = $cacheSpace; |
57 | - $scriptDir = $this->appMeta->tmpDir . '/di'; |
|
58 | - ! \file_exists($scriptDir) && \mkdir($scriptDir); |
|
57 | + $scriptDir = $this->appMeta->tmpDir.'/di'; |
|
58 | + !\file_exists($scriptDir) && \mkdir($scriptDir); |
|
59 | 59 | $this->scriptDir = $scriptDir; |
60 | - $appDir = $this->appMeta->tmpDir . '/app'; |
|
61 | - ! \file_exists($appDir) && \mkdir($appDir); |
|
62 | - touch($appDir . '/.do_not_clear'); |
|
60 | + $appDir = $this->appMeta->tmpDir.'/app'; |
|
61 | + !\file_exists($appDir) && \mkdir($appDir); |
|
62 | + touch($appDir.'/.do_not_clear'); |
|
63 | 63 | $this->appDir = $appDir; |
64 | - $this->injector = new ScriptInjector($this->scriptDir, function () { |
|
64 | + $this->injector = new ScriptInjector($this->scriptDir, function() { |
|
65 | 65 | return $this->getModule(); |
66 | 66 | }); |
67 | - if (! $cacheSpace) { |
|
67 | + if (!$cacheSpace) { |
|
68 | 68 | $this->clear(); |
69 | 69 | } |
70 | 70 | } |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | if ((new Unlink)->once($this->appMeta->tmpDir)) { |
91 | 91 | return; |
92 | 92 | } |
93 | - ! is_dir($this->appMeta->tmpDir . '/di') && \mkdir($this->appMeta->tmpDir . '/di'); |
|
94 | - file_put_contents($this->scriptDir . ScriptInjector::MODULE, serialize($this->getModule())); |
|
93 | + !is_dir($this->appMeta->tmpDir.'/di') && \mkdir($this->appMeta->tmpDir.'/di'); |
|
94 | + file_put_contents($this->scriptDir.ScriptInjector::MODULE, serialize($this->getModule())); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public function getCachedInstance($interface, $name = Name::ANY) |
98 | 98 | { |
99 | - $lockFile = $this->appMeta->appDir . '/composer.lock'; |
|
99 | + $lockFile = $this->appMeta->appDir.'/composer.lock'; |
|
100 | 100 | $this->cacheSpace .= file_exists($lockFile) ? (string) filemtime($lockFile) : ''; |
101 | 101 | $cache = new FilesystemCache($this->appDir); |
102 | - $id = $interface . $name . $this->context . $this->cacheSpace; |
|
102 | + $id = $interface.$name.$this->context.$this->cacheSpace; |
|
103 | 103 | $instance = $cache->fetch($id); |
104 | 104 | if ($instance) { |
105 | 105 | return $instance; |
@@ -30,10 +30,10 @@ |
||
30 | 30 | |
31 | 31 | public function newApp(AbstractAppMeta $appMeta, string $contexts, Cache $cache = null) : AbstractApp |
32 | 32 | { |
33 | - $cacheNs = filemtime($appMeta->appDir . '/src'); |
|
33 | + $cacheNs = filemtime($appMeta->appDir.'/src'); |
|
34 | 34 | $injector = new AppInjector($appMeta->name, $contexts, $appMeta, $cacheNs); |
35 | 35 | $cache = $cache instanceof Cache ? $cache : $injector->getCachedInstance(Cache::class); |
36 | - $appId = $appMeta->name . $contexts . $cacheNs; |
|
36 | + $appId = $appMeta->name.$contexts.$cacheNs; |
|
37 | 37 | $app = $cache->fetch($appId); |
38 | 38 | if ($app instanceof AbstractApp) { |
39 | 39 | return $app; |
@@ -20,10 +20,10 @@ |
||
20 | 20 | |
21 | 21 | public function __invoke(string $path) |
22 | 22 | { |
23 | - if ($this->isOptional && file_exists($path . '/.do_not_clear')) { |
|
23 | + if ($this->isOptional && file_exists($path.'/.do_not_clear')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | - foreach (\glob(\rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*') as $file) { |
|
26 | + foreach (\glob(\rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*') as $file) { |
|
27 | 27 | \is_dir($file) ? $this->__invoke($file) : \unlink($file); |
28 | 28 | @\rmdir($file); |
29 | 29 | } |