@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | #[Proxy] ContainerInterface $container, |
24 | 24 | private readonly FactoryInterface $factory, |
25 | 25 | private readonly DirectoriesInterface $dirs, |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | $this->setContainer($container); |
28 | 28 | |
29 | 29 | parent::__construct(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return $this->factory->make( |
41 | 41 | $class, |
42 | 42 | [ |
43 | - 'name' => (string) $this->argument('name'), |
|
43 | + 'name' => (string)$this->argument('name'), |
|
44 | 44 | 'comment' => $this->getComment(), |
45 | 45 | 'namespace' => $this->getNamespace(), |
46 | 46 | ] + $params + $this->config->declarationOptions($class::TYPE), |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $filename = $this->config->classFilename( |
56 | 56 | $declaration::TYPE, |
57 | - (string) $this->argument('name'), |
|
57 | + (string)$this->argument('name'), |
|
58 | 58 | $this->getNamespace(), |
59 | 59 | ); |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $className = $declaration->getClass()->getName(); |
64 | 64 | $relativeFilename = \str_replace($rootDirectory, '', $filename); |
65 | 65 | |
66 | - if ($this->files->exists($filename)) { |
|
66 | + if ($this->files->exists($filename)){ |
|
67 | 67 | $this->writeln( |
68 | 68 | \sprintf("<fg=red>Unable to create '<comment>%s</comment>' declaration, ", $className) |
69 | 69 | . \sprintf("file '<comment>%s</comment>' already exists.</fg=red>", $relativeFilename), |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | . \sprintf("has been successfully written into '<comment>%s</comment>'.", $relativeFilename), |
81 | 81 | ); |
82 | 82 | |
83 | - if ($declaration instanceof HasInstructions && \count($declaration->getInstructions()) > 0) { |
|
83 | + if ($declaration instanceof HasInstructions && \count($declaration->getInstructions()) > 0){ |
|
84 | 84 | $this->newLine(); |
85 | 85 | $this->writeln('<fg=green>Next steps:</fg=green>'); |
86 | 86 | |
87 | - foreach ($declaration->getInstructions() as $i => $instruction) { |
|
88 | - $this->writeln(\sprintf('%d. %s', (string) (++$i), $instruction)); |
|
87 | + foreach ($declaration->getInstructions() as $i => $instruction){ |
|
88 | + $this->writeln(\sprintf('%d. %s', (string)(++$i), $instruction)); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -63,7 +63,8 @@ discard block |
||
63 | 63 | $className = $declaration->getClass()->getName(); |
64 | 64 | $relativeFilename = \str_replace($rootDirectory, '', $filename); |
65 | 65 | |
66 | - if ($this->files->exists($filename)) { |
|
66 | + if ($this->files->exists($filename)) |
|
67 | + { |
|
67 | 68 | $this->writeln( |
68 | 69 | \sprintf("<fg=red>Unable to create '<comment>%s</comment>' declaration, ", $className) |
69 | 70 | . \sprintf("file '<comment>%s</comment>' already exists.</fg=red>", $relativeFilename), |
@@ -80,11 +81,13 @@ discard block |
||
80 | 81 | . \sprintf("has been successfully written into '<comment>%s</comment>'.", $relativeFilename), |
81 | 82 | ); |
82 | 83 | |
83 | - if ($declaration instanceof HasInstructions && \count($declaration->getInstructions()) > 0) { |
|
84 | + if ($declaration instanceof HasInstructions && \count($declaration->getInstructions()) > 0) |
|
85 | + { |
|
84 | 86 | $this->newLine(); |
85 | 87 | $this->writeln('<fg=green>Next steps:</fg=green>'); |
86 | 88 | |
87 | - foreach ($declaration->getInstructions() as $i => $instruction) { |
|
89 | + foreach ($declaration->getInstructions() as $i => $instruction) |
|
90 | + { |
|
88 | 91 | $this->writeln(\sprintf('%d. %s', (string) (++$i), $instruction)); |
89 | 92 | } |
90 | 93 | } |
@@ -7,4 +7,4 @@ |
||
7 | 7 | /** |
8 | 8 | * Generic scaffolding exception. |
9 | 9 | */ |
10 | -class ScaffolderException extends \RuntimeException {} |
|
10 | +class ScaffolderException extends \RuntimeException{} |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function __construct( |
26 | 26 | private readonly ConfiguratorInterface $config, |
27 | 27 | private readonly KernelInterface $kernel, |
28 | - ) {} |
|
28 | + ){} |
|
29 | 29 | |
30 | 30 | public function init(ConsoleBootloader $console, DirectoriesInterface $dir): void |
31 | 31 | { |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $console->addCommand(Command\MiddlewareCommand::class); |
39 | 39 | $console->addCommand(Command\FilterCommand::class); |
40 | 40 | |
41 | - try { |
|
41 | + try{ |
|
42 | 42 | $defaultNamespace = (new \ReflectionClass($this->kernel))->getNamespaceName(); |
43 | - } catch (\ReflectionException) { |
|
43 | + }catch (\ReflectionException){ |
|
44 | 44 | $defaultNamespace = ''; |
45 | 45 | } |
46 | 46 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * Base directory for generated classes, class will be automatically localed into sub directory |
56 | 56 | * using given namespace. |
57 | 57 | */ |
58 | - 'directory' => $dir->get('app') . 'src/', |
|
58 | + 'directory' => $dir->get('app').'src/', |
|
59 | 59 | |
60 | 60 | /* |
61 | 61 | * Default namespace to be applied for every generated class. By default uses Kernel namespace |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | public function __construct( |
26 | 26 | private readonly ConfiguratorInterface $config, |
27 | 27 | private readonly KernelInterface $kernel, |
28 | - ) {} |
|
28 | + ) { |
|
29 | +} |
|
29 | 30 | |
30 | 31 | public function init(ConsoleBootloader $console, DirectoriesInterface $dir): void |
31 | 32 | { |
@@ -38,9 +39,12 @@ discard block |
||
38 | 39 | $console->addCommand(Command\MiddlewareCommand::class); |
39 | 40 | $console->addCommand(Command\FilterCommand::class); |
40 | 41 | |
41 | - try { |
|
42 | + try |
|
43 | + { |
|
42 | 44 | $defaultNamespace = (new \ReflectionClass($this->kernel))->getNamespaceName(); |
43 | - } catch (\ReflectionException) { |
|
45 | + } |
|
46 | + catch (\ReflectionException) |
|
47 | + { |
|
44 | 48 | $defaultNamespace = ''; |
45 | 49 | } |
46 | 50 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | final class CacheHandlerTest extends TestCase |
14 | 14 | { |
15 | 15 | private CacheHandler $handler; |
16 | - private m\MockInterface|CacheInterface $cache; |
|
16 | + private m\MockInterface | CacheInterface $cache; |
|
17 | 17 | |
18 | 18 | public function testClose(): void |
19 | 19 | { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private readonly FilesInterface $files, |
16 | 16 | private readonly string $directory, |
17 | - ) {} |
|
17 | + ){} |
|
18 | 18 | |
19 | 19 | public function close(): bool |
20 | 20 | { |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function gc(int $maxlifetime): int |
37 | 37 | { |
38 | - foreach ($this->files->getFiles($this->directory) as $filename) { |
|
39 | - if ($this->files->time($filename) < \time() - $maxlifetime) { |
|
38 | + foreach ($this->files->getFiles($this->directory) as $filename){ |
|
39 | + if ($this->files->time($filename) < \time() - $maxlifetime){ |
|
40 | 40 | $this->files->delete($filename); |
41 | 41 | } |
42 | 42 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private readonly FilesInterface $files, |
16 | 16 | private readonly string $directory, |
17 | - ) {} |
|
17 | + ) { |
|
18 | +} |
|
18 | 19 | |
19 | 20 | public function close(): bool |
20 | 21 | { |
@@ -35,8 +36,10 @@ discard block |
||
35 | 36 | */ |
36 | 37 | public function gc(int $maxlifetime): int |
37 | 38 | { |
38 | - foreach ($this->files->getFiles($this->directory) as $filename) { |
|
39 | - if ($this->files->time($filename) < \time() - $maxlifetime) { |
|
39 | + foreach ($this->files->getFiles($this->directory) as $filename) |
|
40 | + { |
|
41 | + if ($this->files->time($filename) < \time() - $maxlifetime) |
|
42 | + { |
|
40 | 43 | $this->files->delete($filename); |
41 | 44 | } |
42 | 45 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | private readonly ?string $storage = null, |
18 | 18 | private readonly int $ttl = 86400, |
19 | 19 | private readonly string $prefix = 'session:', |
20 | - ) { |
|
20 | + ){ |
|
21 | 21 | $this->cache = $storageProvider->storage($this->storage); |
22 | 22 | } |
23 | 23 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | |
39 | - public function gc(int $max_lifetime): int|false |
|
39 | + public function gc(int $max_lifetime): int | false |
|
40 | 40 | { |
41 | 41 | return 0; |
42 | 42 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @throws InvalidArgumentException |
51 | 51 | */ |
52 | - public function read(string $id): string|false |
|
52 | + public function read(string $id): string | false |
|
53 | 53 | { |
54 | 54 | $result = $this->cache->get($this->getKey($id)); |
55 | 55 | |
56 | - return (string) $result; |
|
56 | + return (string)$result; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,6 +66,6 @@ discard block |
||
66 | 66 | |
67 | 67 | private function getKey(string $id): string |
68 | 68 | { |
69 | - return $this->prefix . $id; |
|
69 | + return $this->prefix.$id; |
|
70 | 70 | } |
71 | 71 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private readonly SessionInterface $session, |
16 | 16 | private readonly string $name, |
17 | - ) {} |
|
17 | + ){} |
|
18 | 18 | |
19 | 19 | public function getName(): string |
20 | 20 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function get(string $name, mixed $default = null): mixed |
53 | 53 | { |
54 | - if (!$this->has($name)) { |
|
54 | + if (!$this->has($name)){ |
|
55 | 55 | return $default; |
56 | 56 | } |
57 | 57 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | $this->session->resume(); |
130 | 130 | |
131 | - if (!isset($_SESSION[$this->name])) { |
|
131 | + if (!isset($_SESSION[$this->name])){ |
|
132 | 132 | $_SESSION[$this->name] = []; |
133 | 133 | } |
134 | 134 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private readonly SessionInterface $session, |
16 | 16 | private readonly string $name, |
17 | - ) {} |
|
17 | + ) { |
|
18 | +} |
|
18 | 19 | |
19 | 20 | public function getName(): string |
20 | 21 | { |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | |
52 | 53 | public function get(string $name, mixed $default = null): mixed |
53 | 54 | { |
54 | - if (!$this->has($name)) { |
|
55 | + if (!$this->has($name)) |
|
56 | + { |
|
55 | 57 | return $default; |
56 | 58 | } |
57 | 59 | |
@@ -128,7 +130,8 @@ discard block |
||
128 | 130 | { |
129 | 131 | $this->session->resume(); |
130 | 132 | |
131 | - if (!isset($_SESSION[$this->name])) { |
|
133 | + if (!isset($_SESSION[$this->name])) |
|
134 | + { |
|
132 | 135 | $_SESSION[$this->name] = []; |
133 | 136 | } |
134 | 137 | } |
@@ -4,4 +4,4 @@ |
||
4 | 4 | |
5 | 5 | namespace Spiral\Session\Exception; |
6 | 6 | |
7 | -class MultipleSessionException extends SessionException {} |
|
7 | +class MultipleSessionException extends SessionException{} |
@@ -4,4 +4,6 @@ |
||
4 | 4 | |
5 | 5 | namespace Spiral\Session\Exception; |
6 | 6 | |
7 | -class MultipleSessionException extends SessionException {} |
|
7 | +class MultipleSessionException extends SessionException |
|
8 | +{ |
|
9 | +} |
@@ -4,4 +4,4 @@ |
||
4 | 4 | |
5 | 5 | namespace Spiral\Session\Exception; |
6 | 6 | |
7 | -class SessionException extends \RuntimeException {} |
|
7 | +class SessionException extends \RuntimeException{} |