@@ -9,4 +9,4 @@ |
||
9 | 9 | ini_set('display_errors', true); |
10 | 10 | |
11 | 11 | //Composer |
12 | -require dirname(__DIR__) . '/vendor/autoload.php'; |
|
13 | 12 | \ No newline at end of file |
13 | +require dirname(__DIR__).'/vendor/autoload.php'; |
|
14 | 14 | \ No newline at end of file |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | $http = $this->container->get(HttpCore::class); |
59 | 59 | $emitter = $this->container->get(EmitterInterface::class); |
60 | 60 | |
61 | - try { |
|
61 | + try{ |
|
62 | 62 | $response = $http->handle($this->initRequest()); |
63 | 63 | $emitter->emit($response); |
64 | - } catch (\Throwable $e) { |
|
64 | + }catch (\Throwable $e){ |
|
65 | 65 | $this->handleException($emitter, $e); |
66 | 66 | } |
67 | 67 | } |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | { |
83 | 83 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
84 | 84 | |
85 | - try { |
|
85 | + try{ |
|
86 | 86 | /** @var SnapshotInterface $snapshot */ |
87 | 87 | $this->container->get(SnapshotterInterface::class)->register($e); |
88 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
88 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
89 | 89 | // nothing to report |
90 | 90 | } |
91 | 91 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | HttpConfig $httpConfig, |
51 | 51 | SessionFactory $factory, |
52 | 52 | ScopeInterface $scope |
53 | - ) { |
|
53 | + ){ |
|
54 | 54 | $this->config = $config; |
55 | 55 | $this->httpConfig = $httpConfig; |
56 | 56 | $this->factory = $factory; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | Request $request, |
91 | 91 | Response $response |
92 | 92 | ): Response { |
93 | - if (!$session->isStarted()) { |
|
93 | + if (!$session->isStarted()){ |
|
94 | 94 | return $response; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $session->commit(); |
98 | 98 | |
99 | 99 | //SID changed |
100 | - if ($this->fetchID($request) != $session->getID()) { |
|
100 | + if ($this->fetchID($request) != $session->getID()){ |
|
101 | 101 | return $this->withCookie($request, $response, $session->getID()); |
102 | 102 | } |
103 | 103 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | protected function fetchID(Request $request): ?string |
116 | 116 | { |
117 | 117 | $cookies = $request->getCookieParams(); |
118 | - if (empty($cookies[$this->config->getCookie()])) { |
|
118 | + if (empty($cookies[$this->config->getCookie()])){ |
|
119 | 119 | return null; |
120 | 120 | } |
121 | 121 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | protected function clientSignature(Request $request): string |
151 | 151 | { |
152 | 152 | $signature = ''; |
153 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
154 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
153 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
154 | + $signature .= $request->getHeaderLine($header).';'; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return hash('sha256', $signature); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @author Anton Titov (Wolfy-J) |
7 | 7 | */ |
8 | 8 | |
9 | -if (!function_exists('bind')) { |
|
9 | +if (!function_exists('bind')){ |
|
10 | 10 | /** |
11 | 11 | * Shortcut to container Autowire definition. |
12 | 12 | * |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | int $verbosity, |
48 | 48 | HandlerInterface $handler, |
49 | 49 | FilesInterface $files |
50 | - ) { |
|
50 | + ){ |
|
51 | 51 | $this->directory = $directory; |
52 | 52 | $this->maxFiles = $maxFiles; |
53 | 53 | $this->verbosity = $verbosity; |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | protected function rotateSnapshots() |
92 | 92 | { |
93 | 93 | $finder = new Finder(); |
94 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
94 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b){ |
|
95 | 95 | return $b->getMTime() - $a->getMTime(); |
96 | 96 | }); |
97 | 97 | |
98 | 98 | $count = 0; |
99 | - foreach ($finder as $file) { |
|
99 | + foreach ($finder as $file){ |
|
100 | 100 | $count++; |
101 | - if ($count > $this->maxFiles) { |
|
102 | - try { |
|
101 | + if ($count > $this->maxFiles){ |
|
102 | + try{ |
|
103 | 103 | $this->files->delete($file->getRealPath()); |
104 | - } catch (FilesException $e) { |
|
104 | + }catch (FilesException $e){ |
|
105 | 105 | |
106 | 106 | } |
107 | 107 | } |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | /** @var ConsoleCore $core */ |
64 | 64 | $core = $this->container->get(ConsoleCore::class); |
65 | 65 | |
66 | - try { |
|
66 | + try{ |
|
67 | 67 | $core->start(new ArgvInput(), $output); |
68 | - } catch (\Throwable $e) { |
|
68 | + }catch (\Throwable $e){ |
|
69 | 69 | $this->handleException($e, $output); |
70 | - } finally { |
|
70 | + }finally{ |
|
71 | 71 | $listener->disable(); |
72 | 72 | } |
73 | 73 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function handleException(\Throwable $e, OutputInterface $output) |
80 | 80 | { |
81 | - try { |
|
81 | + try{ |
|
82 | 82 | $this->container->get(SnapshotterInterface::class)->register($e); |
83 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
83 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
84 | 84 | // no need to notify when unable to register an exception |
85 | 85 | } |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function mapVerbosity(OutputInterface $output): int |
97 | 97 | { |
98 | - if ($output->isDebug()) { |
|
98 | + if ($output->isDebug()){ |
|
99 | 99 | return ConsoleHandler::VERBOSITY_DEBUG; |
100 | 100 | } |
101 | 101 | |
102 | - if ($output->isVerbose() || $output->isVeryVerbose()) { |
|
102 | + if ($output->isVerbose() || $output->isVeryVerbose()){ |
|
103 | 103 | return ConsoleHandler::VERBOSITY_VERBOSE; |
104 | 104 | } |
105 | 105 |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function __invoke(LogEvent $event) |
50 | 50 | { |
51 | - if (empty($this->output)) { |
|
51 | + if (empty($this->output)){ |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
56 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){ |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function enable(): self |
91 | 91 | { |
92 | - if (!empty($this->logs)) { |
|
92 | + if (!empty($this->logs)){ |
|
93 | 93 | $this->logs->addListener($this); |
94 | 94 | } |
95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function disable(): self |
105 | 105 | { |
106 | - if (!empty($this->logs)) { |
|
106 | + if (!empty($this->logs)){ |
|
107 | 107 | $this->logs->removeListener($this); |
108 | 108 | } |
109 | 109 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | private function getChannel(string $channel): string |
129 | 129 | { |
130 | - if (!class_exists($channel, false)) { |
|
130 | + if (!class_exists($channel, false)){ |
|
131 | 131 | return "[{$channel}]"; |
132 | 132 | } |
133 | 133 | |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function getMessage(bool $decorated, string $message) |
145 | 145 | { |
146 | - if (!$decorated) { |
|
146 | + if (!$decorated){ |
|
147 | 147 | return $message; |
148 | 148 | } |
149 | 149 | |
150 | - return Color::GRAY . $message . Color::RESET; |
|
150 | + return Color::GRAY.$message.Color::RESET; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | \ No newline at end of file |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | |
44 | 44 | $runtimeDirectory = $this->directories->get('runtime'); |
45 | 45 | |
46 | - if (!$this->files->exists($runtimeDirectory)) { |
|
46 | + if (!$this->files->exists($runtimeDirectory)){ |
|
47 | 47 | $this->files->ensureDirectory($runtimeDirectory); |
48 | 48 | $output->writeln("<comment>created</comment>"); |
49 | 49 | return; |
50 | - } else { |
|
50 | + }else{ |
|
51 | 51 | $output->writeln("<info>exists</info>"); |
52 | 52 | } |
53 | 53 | |
54 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
55 | - try { |
|
54 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename){ |
|
55 | + try{ |
|
56 | 56 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
57 | 57 | $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME); |
58 | - } catch (\Throwable $e) { |
|
58 | + }catch (\Throwable $e){ |
|
59 | 59 | $output->writeln(sprintf( |
60 | 60 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>", |
61 | 61 | $this->files->relativePath($filename, $runtimeDirectory), |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | continue; |
65 | 65 | } |
66 | 66 | |
67 | - if ($output->isVerbose()) { |
|
67 | + if ($output->isVerbose()){ |
|
68 | 68 | $output->writeln(sprintf( |
69 | 69 | "<fg=green>[updated]</fg=green> `%s`", |
70 | 70 | $this->files->relativePath($filename, $runtimeDirectory) |
@@ -77,7 +77,7 @@ |
||
77 | 77 | */ |
78 | 78 | private function sequencePatch(string $target, $sequence, string $header, string $footer, array $options) |
79 | 79 | { |
80 | - if (is_array($sequence)) { |
|
80 | + if (is_array($sequence)){ |
|
81 | 81 | return new AppendPatch($target, null, new CallableSequence($sequence, $options, $header, $footer)); |
82 | 82 | } |
83 | 83 |