@@ -42,22 +42,27 @@ discard block |
||
42 | 42 | public function init(Container $container, FinalizerInterface $finalizer): void |
43 | 43 | { |
44 | 44 | $finalizer->addFinalizer(static function (bool $terminate) use ($container): void { |
45 | - if ($terminate) { |
|
45 | + if ($terminate) |
|
46 | + { |
|
46 | 47 | return; |
47 | 48 | } |
48 | 49 | |
49 | - if ($container->hasInstance(LoggerInterface::class)) { |
|
50 | + if ($container->hasInstance(LoggerInterface::class)) |
|
51 | + { |
|
50 | 52 | $logger = $container->get(LoggerInterface::class); |
51 | 53 | |
52 | - if ($logger instanceof ResettableInterface) { |
|
54 | + if ($logger instanceof ResettableInterface) |
|
55 | + { |
|
53 | 56 | $logger->reset(); |
54 | 57 | } |
55 | 58 | } |
56 | 59 | |
57 | - if ($container->hasInstance(LogsInterface::class)) { |
|
60 | + if ($container->hasInstance(LogsInterface::class)) |
|
61 | + { |
|
58 | 62 | $factory = $container->get(LogsInterface::class); |
59 | 63 | |
60 | - if ($factory instanceof ResettableInterface) { |
|
64 | + if ($factory instanceof ResettableInterface) |
|
65 | + { |
|
61 | 66 | $factory->reset(); |
62 | 67 | } |
63 | 68 | } |
@@ -74,7 +79,8 @@ discard block |
||
74 | 79 | |
75 | 80 | public function addHandler(string $channel, HandlerInterface $handler): void |
76 | 81 | { |
77 | - if (!isset($this->config->getConfig(MonologConfig::CONFIG)['handlers'][$channel])) { |
|
82 | + if (!isset($this->config->getConfig(MonologConfig::CONFIG)['handlers'][$channel])) |
|
83 | + { |
|
78 | 84 | $this->config->modify(MonologConfig::CONFIG, new Append('handlers', $channel, [])); |
79 | 85 | } |
80 | 86 |
@@ -37,28 +37,28 @@ discard block |
||
37 | 37 | public function __construct( |
38 | 38 | private readonly ConfiguratorInterface $config, |
39 | 39 | private readonly EnvironmentInterface $env, |
40 | - ) { |
|
40 | + ){ |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function init(Container $container, FinalizerInterface $finalizer): void |
44 | 44 | { |
45 | 45 | $finalizer->addFinalizer(static function (bool $terminate) use ($container): void { |
46 | - if ($terminate) { |
|
46 | + if ($terminate){ |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | - if ($container->hasInstance(LoggerInterface::class)) { |
|
50 | + if ($container->hasInstance(LoggerInterface::class)){ |
|
51 | 51 | $logger = $container->get(LoggerInterface::class); |
52 | 52 | |
53 | - if ($logger instanceof ResettableInterface) { |
|
53 | + if ($logger instanceof ResettableInterface){ |
|
54 | 54 | $logger->reset(); |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - if ($container->hasInstance(LogsInterface::class)) { |
|
58 | + if ($container->hasInstance(LogsInterface::class)){ |
|
59 | 59 | $factory = $container->get(LogsInterface::class); |
60 | 60 | |
61 | - if ($factory instanceof ResettableInterface) { |
|
61 | + if ($factory instanceof ResettableInterface){ |
|
62 | 62 | $factory->reset(); |
63 | 63 | } |
64 | 64 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | public function addHandler(string $channel, HandlerInterface $handler): void |
77 | 77 | { |
78 | - if (!isset($this->config->getConfig(MonologConfig::CONFIG)['handlers'][$channel])) { |
|
78 | + if (!isset($this->config->getConfig(MonologConfig::CONFIG)['handlers'][$channel])){ |
|
79 | 79 | $this->config->modify(MonologConfig::CONFIG, new Append('handlers', $channel, [])); |
80 | 80 | } |
81 | 81 | |
82 | 82 | $this->config->modify( |
83 | 83 | MonologConfig::CONFIG, |
84 | 84 | new Append( |
85 | - 'handlers.' . $channel, |
|
85 | + 'handlers.'.$channel, |
|
86 | 86 | null, |
87 | 87 | $handler |
88 | 88 | ) |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function logRotate( |
93 | 93 | string $filename, |
94 | - int|Level $level = Logger::DEBUG, |
|
94 | + int | Level $level = Logger::DEBUG, |
|
95 | 95 | int $maxFiles = 0, |
96 | 96 | bool $bubble = true |
97 | 97 | ): HandlerInterface { |
@@ -101,7 +101,8 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getLocaleDirectory(string $locale, ?string $directory = null): string |
103 | 103 | { |
104 | - if ($directory !== null) { |
|
104 | + if ($directory !== null) |
|
105 | + { |
|
105 | 106 | return \rtrim($directory, '/') . '/' . $locale . '/'; |
106 | 107 | } |
107 | 108 | |
@@ -116,9 +117,12 @@ discard block |
||
116 | 117 | $bundle = \strtolower(\str_replace(['/', '\\'], '-', $bundle)); |
117 | 118 | $domains = (array) ($this->config['domains'] ?? []); |
118 | 119 | |
119 | - foreach ($domains as $domain => $patterns) { |
|
120 | - foreach ($patterns as $pattern) { |
|
121 | - if ($this->matcher->matches($bundle, $pattern)) { |
|
120 | + foreach ($domains as $domain => $patterns) |
|
121 | + { |
|
122 | + foreach ($patterns as $pattern) |
|
123 | + { |
|
124 | + if ($this->matcher->matches($bundle, $pattern)) |
|
125 | + { |
|
122 | 126 | return $domain; |
123 | 127 | } |
124 | 128 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getLocaleDirectory(string $locale, ?string $directory = null): string |
103 | 103 | { |
104 | - if ($directory !== null) { |
|
105 | - return \rtrim($directory, '/') . '/' . $locale . '/'; |
|
104 | + if ($directory !== null){ |
|
105 | + return \rtrim($directory, '/').'/'.$locale.'/'; |
|
106 | 106 | } |
107 | 107 | |
108 | - return \rtrim($this->getLocalesDirectory(), '/') . '/' . $locale . '/'; |
|
108 | + return \rtrim($this->getLocalesDirectory(), '/').'/'.$locale.'/'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | public function resolveDomain(string $bundle): string |
115 | 115 | { |
116 | 116 | $bundle = \strtolower(\str_replace(['/', '\\'], '-', $bundle)); |
117 | - $domains = (array) ($this->config['domains'] ?? []); |
|
117 | + $domains = (array)($this->config['domains'] ?? []); |
|
118 | 118 | |
119 | - foreach ($domains as $domain => $patterns) { |
|
120 | - foreach ($patterns as $pattern) { |
|
121 | - if ($this->matcher->matches($bundle, $pattern)) { |
|
119 | + foreach ($domains as $domain => $patterns){ |
|
120 | + foreach ($patterns as $pattern){ |
|
121 | + if ($this->matcher->matches($bundle, $pattern)){ |
|
122 | 122 | return $domain; |
123 | 123 | } |
124 | 124 | } |
@@ -16,15 +16,15 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct( |
18 | 18 | private readonly TranslatorConfig $config |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function hasLocale(string $locale): bool |
23 | 23 | { |
24 | 24 | $locale = \preg_replace('/[^a-zA-Z_]/', '', \mb_strtolower($locale)); |
25 | 25 | |
26 | - foreach ($this->getDirectories() as $directory) { |
|
27 | - if (\is_dir($this->config->getLocaleDirectory($locale, $directory))) { |
|
26 | + foreach ($this->getDirectories() as $directory){ |
|
27 | + if (\is_dir($this->config->getLocaleDirectory($locale, $directory))){ |
|
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | } |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | public function getLocales(): array |
36 | 36 | { |
37 | 37 | $directories = $this->getDirectories(); |
38 | - if ($directories === []) { |
|
38 | + if ($directories === []){ |
|
39 | 39 | return []; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $finder = new Finder(); |
43 | 43 | $locales = []; |
44 | - foreach ($finder->in($directories)->directories() as $directory) { |
|
44 | + foreach ($finder->in($directories)->directories() as $directory){ |
|
45 | 45 | $locales[] = $directory->getFilename(); |
46 | 46 | } |
47 | 47 | |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | $locale = \preg_replace('/[^a-zA-Z_]/', '', \mb_strtolower($locale)); |
54 | 54 | $catalogue = new Catalogue($locale); |
55 | 55 | |
56 | - if (!$this->hasLocale($locale)) { |
|
56 | + if (!$this->hasLocale($locale)){ |
|
57 | 57 | return $catalogue; |
58 | 58 | } |
59 | 59 | |
60 | 60 | $directories = []; |
61 | - foreach ($this->getDirectories() as $directory) { |
|
62 | - if (\is_dir($this->config->getLocaleDirectory($locale, $directory))) { |
|
61 | + foreach ($this->getDirectories() as $directory){ |
|
62 | + if (\is_dir($this->config->getLocaleDirectory($locale, $directory))){ |
|
63 | 63 | $directories[] = $this->config->getLocaleDirectory($locale, $directory); |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | 67 | $finder = new Finder(); |
68 | - foreach ($finder->in($directories)->files() as $file) { |
|
68 | + foreach ($finder->in($directories)->files() as $file){ |
|
69 | 69 | $this->getLogger()->info( |
70 | 70 | \sprintf( |
71 | 71 | "found locale domain file '%s'", |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | //Per application agreement domain name must present in filename |
78 | 78 | $domain = \strstr($file->getFilename(), '.', true); |
79 | 79 | |
80 | - if (!$this->config->hasLoader($file->getExtension())) { |
|
80 | + if (!$this->config->hasLoader($file->getExtension())){ |
|
81 | 81 | $this->getLogger()->warning( |
82 | 82 | \sprintf( |
83 | 83 | "unable to load domain file '%s', no loader found", |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | private function getDirectories(): array |
108 | 108 | { |
109 | 109 | $directories = []; |
110 | - if (\is_dir($this->config->getLocalesDirectory())) { |
|
110 | + if (\is_dir($this->config->getLocalesDirectory())){ |
|
111 | 111 | $directories[] = $this->config->getLocalesDirectory(); |
112 | 112 | } |
113 | 113 | |
114 | - foreach ($this->config->getDirectories() as $directory) { |
|
115 | - if (\is_dir($directory)) { |
|
114 | + foreach ($this->config->getDirectories() as $directory){ |
|
115 | + if (\is_dir($directory)){ |
|
116 | 116 | $directories[] = $directory; |
117 | 117 | } |
118 | 118 | } |
@@ -23,8 +23,10 @@ discard block |
||
23 | 23 | { |
24 | 24 | $locale = \preg_replace('/[^a-zA-Z_]/', '', \mb_strtolower($locale)); |
25 | 25 | |
26 | - foreach ($this->getDirectories() as $directory) { |
|
27 | - if (\is_dir($this->config->getLocaleDirectory($locale, $directory))) { |
|
26 | + foreach ($this->getDirectories() as $directory) |
|
27 | + { |
|
28 | + if (\is_dir($this->config->getLocaleDirectory($locale, $directory))) |
|
29 | + { |
|
28 | 30 | return true; |
29 | 31 | } |
30 | 32 | } |
@@ -35,13 +37,15 @@ discard block |
||
35 | 37 | public function getLocales(): array |
36 | 38 | { |
37 | 39 | $directories = $this->getDirectories(); |
38 | - if ($directories === []) { |
|
40 | + if ($directories === []) |
|
41 | + { |
|
39 | 42 | return []; |
40 | 43 | } |
41 | 44 | |
42 | 45 | $finder = new Finder(); |
43 | 46 | $locales = []; |
44 | - foreach ($finder->in($directories)->directories() as $directory) { |
|
47 | + foreach ($finder->in($directories)->directories() as $directory) |
|
48 | + { |
|
45 | 49 | $locales[] = $directory->getFilename(); |
46 | 50 | } |
47 | 51 | |
@@ -53,19 +57,23 @@ discard block |
||
53 | 57 | $locale = \preg_replace('/[^a-zA-Z_]/', '', \mb_strtolower($locale)); |
54 | 58 | $catalogue = new Catalogue($locale); |
55 | 59 | |
56 | - if (!$this->hasLocale($locale)) { |
|
60 | + if (!$this->hasLocale($locale)) |
|
61 | + { |
|
57 | 62 | return $catalogue; |
58 | 63 | } |
59 | 64 | |
60 | 65 | $directories = []; |
61 | - foreach ($this->getDirectories() as $directory) { |
|
62 | - if (\is_dir($this->config->getLocaleDirectory($locale, $directory))) { |
|
66 | + foreach ($this->getDirectories() as $directory) |
|
67 | + { |
|
68 | + if (\is_dir($this->config->getLocaleDirectory($locale, $directory))) |
|
69 | + { |
|
63 | 70 | $directories[] = $this->config->getLocaleDirectory($locale, $directory); |
64 | 71 | } |
65 | 72 | } |
66 | 73 | |
67 | 74 | $finder = new Finder(); |
68 | - foreach ($finder->in($directories)->files() as $file) { |
|
75 | + foreach ($finder->in($directories)->files() as $file) |
|
76 | + { |
|
69 | 77 | $this->getLogger()->info( |
70 | 78 | \sprintf( |
71 | 79 | "found locale domain file '%s'", |
@@ -77,7 +85,8 @@ discard block |
||
77 | 85 | //Per application agreement domain name must present in filename |
78 | 86 | $domain = \strstr($file->getFilename(), '.', true); |
79 | 87 | |
80 | - if (!$this->config->hasLoader($file->getExtension())) { |
|
88 | + if (!$this->config->hasLoader($file->getExtension())) |
|
89 | + { |
|
81 | 90 | $this->getLogger()->warning( |
82 | 91 | \sprintf( |
83 | 92 | "unable to load domain file '%s', no loader found", |
@@ -107,12 +116,15 @@ discard block |
||
107 | 116 | private function getDirectories(): array |
108 | 117 | { |
109 | 118 | $directories = []; |
110 | - if (\is_dir($this->config->getLocalesDirectory())) { |
|
119 | + if (\is_dir($this->config->getLocalesDirectory())) |
|
120 | + { |
|
111 | 121 | $directories[] = $this->config->getLocalesDirectory(); |
112 | 122 | } |
113 | 123 | |
114 | - foreach ($this->config->getDirectories() as $directory) { |
|
115 | - if (\is_dir($directory)) { |
|
124 | + foreach ($this->config->getDirectories() as $directory) |
|
125 | + { |
|
126 | + if (\is_dir($directory)) |
|
127 | + { |
|
116 | 128 | $directories[] = $directory; |
117 | 129 | } |
118 | 130 | } |
@@ -16,7 +16,8 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp(): void |
18 | 18 | { |
19 | - $this->listener = new class() { |
|
19 | + $this->listener = new class() |
|
20 | + { |
|
20 | 21 | public LogEvent $event; |
21 | 22 | |
22 | 23 | public function __invoke(LogEvent $event): void |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function perform(): int |
16 | 16 | { |
17 | 17 | $prototyped = $this->locator->getTargetClasses(); |
18 | - if ($prototyped === []) { |
|
18 | + if ($prototyped === []){ |
|
19 | 19 | $this->writeln('<comment>No prototyped classes found.</comment>'); |
20 | 20 | |
21 | 21 | return self::SUCCESS; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | $grid = $this->table(['Class:', 'Property:', 'Target:']); |
25 | 25 | |
26 | - foreach ($prototyped as $class) { |
|
26 | + foreach ($prototyped as $class){ |
|
27 | 27 | $proto = $this->getPrototypeProperties($class, $prototyped); |
28 | 28 | |
29 | 29 | $grid->addRow([$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)]); |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | public function perform(): int |
16 | 16 | { |
17 | 17 | $prototyped = $this->locator->getTargetClasses(); |
18 | - if ($prototyped === []) { |
|
18 | + if ($prototyped === []) |
|
19 | + { |
|
19 | 20 | $this->writeln('<comment>No prototyped classes found.</comment>'); |
20 | 21 | |
21 | 22 | return self::SUCCESS; |
@@ -23,7 +24,8 @@ discard block |
||
23 | 24 | |
24 | 25 | $grid = $this->table(['Class:', 'Property:', 'Target:']); |
25 | 26 | |
26 | - foreach ($prototyped as $class) { |
|
27 | + foreach ($prototyped as $class) |
|
28 | + { |
|
27 | 29 | $proto = $this->getPrototypeProperties($class, $prototyped); |
28 | 30 | |
29 | 31 | $grid->addRow([$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)]); |
@@ -27,6 +27,6 @@ |
||
27 | 27 | */ |
28 | 28 | public function getBindings(): array |
29 | 29 | { |
30 | - return (array) ($this->config['bindings'] ?? []); |
|
30 | + return (array)($this->config['bindings'] ?? []); |
|
31 | 31 | } |
32 | 32 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | public function __construct( |
24 | 24 | private readonly ReaderInterface $reader, |
25 | 25 | private readonly PrototypeBootloader $prototype |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function listen(ReflectionClass $class): void |
30 | 30 | { |
31 | 31 | $attribute = $this->reader->firstClassMetadata($class, Prototyped::class); |
32 | - if ($attribute === null) { |
|
32 | + if ($attribute === null){ |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function finalize(): void |
40 | 40 | { |
41 | - foreach ($this->attributes as $property => $class) { |
|
41 | + foreach ($this->attributes as $property => $class){ |
|
42 | 42 | $this->prototype->bindProperty($property, $class); |
43 | 43 | } |
44 | 44 | } |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | public function listen(ReflectionClass $class): void |
30 | 30 | { |
31 | 31 | $attribute = $this->reader->firstClassMetadata($class, Prototyped::class); |
32 | - if ($attribute === null) { |
|
32 | + if ($attribute === null) |
|
33 | + { |
|
33 | 34 | return; |
34 | 35 | } |
35 | 36 | |
@@ -38,7 +39,8 @@ discard block |
||
38 | 39 | |
39 | 40 | public function finalize(): void |
40 | 41 | { |
41 | - foreach ($this->attributes as $property => $class) { |
|
42 | + foreach ($this->attributes as $property => $class) |
|
43 | + { |
|
42 | 44 | $this->prototype->bindProperty($property, $class); |
43 | 45 | } |
44 | 46 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function perform(): int |
13 | 13 | { |
14 | 14 | $bindings = $this->getRegistry()->getPropertyBindings(); |
15 | - if ($bindings === []) { |
|
15 | + if ($bindings === []){ |
|
16 | 16 | $this->comment('No prototype dependencies found.'); |
17 | 17 | |
18 | 18 | return self::SUCCESS; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $grid = $this->table(['Name:', 'Target:']); |
22 | 22 | |
23 | - foreach ($bindings as $binding) { |
|
23 | + foreach ($bindings as $binding){ |
|
24 | 24 | $grid->addRow([$binding->property, $binding->type->name()]); |
25 | 25 | } |
26 | 26 |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | public function perform(): int |
13 | 13 | { |
14 | 14 | $bindings = $this->getRegistry()->getPropertyBindings(); |
15 | - if ($bindings === []) { |
|
15 | + if ($bindings === []) |
|
16 | + { |
|
16 | 17 | $this->comment('No prototype dependencies found.'); |
17 | 18 | |
18 | 19 | return self::SUCCESS; |
@@ -20,7 +21,8 @@ discard block |
||
20 | 21 | |
21 | 22 | $grid = $this->table(['Name:', 'Target:']); |
22 | 23 | |
23 | - foreach ($bindings as $binding) { |
|
24 | + foreach ($bindings as $binding) |
|
25 | + { |
|
24 | 26 | $grid->addRow([$binding->property, $binding->type->name()]); |
25 | 27 | } |
26 | 28 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function __construct( |
20 | 20 | protected readonly PrototypeLocator $locator, |
21 | 21 | protected readonly NodeExtractor $extractor |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $results = [$this->readProperties($class)]; |
35 | 35 | |
36 | 36 | $parent = $class->getParentClass(); |
37 | - while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])) { |
|
37 | + while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])){ |
|
38 | 38 | $results[] = $this->readProperties($parent); |
39 | 39 | $parent = $parent->getParentClass(); |
40 | 40 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | { |
68 | 68 | $result = []; |
69 | 69 | |
70 | - foreach ($properties as $target) { |
|
71 | - if ($target instanceof Throwable) { |
|
70 | + foreach ($properties as $target){ |
|
71 | + if ($target instanceof Throwable){ |
|
72 | 72 | $result[] = \sprintf( |
73 | 73 | '<fg=red>%s [f: %s, l: %s]</fg=red>', |
74 | 74 | $target->getMessage(), |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | |
81 | - if ($target === null) { |
|
81 | + if ($target === null){ |
|
82 | 82 | $result[] = '<fg=yellow>undefined</fg=yellow>'; |
83 | 83 | continue; |
84 | 84 | } |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | */ |
95 | 95 | private function readProperties(\ReflectionClass $class): array |
96 | 96 | { |
97 | - if (isset($this->cache[$class->getFileName()])) { |
|
97 | + if (isset($this->cache[$class->getFileName()])){ |
|
98 | 98 | $proto = $this->cache[$class->getFileName()]; |
99 | - } else { |
|
99 | + }else{ |
|
100 | 100 | $proto = $this->getExtractor()->getPrototypeProperties(\file_get_contents($class->getFileName())); |
101 | 101 | $this->cache[$class->getFileName()] = $proto; |
102 | 102 | } |
103 | 103 | |
104 | 104 | $result = []; |
105 | - foreach ($proto as $name) { |
|
106 | - if (!isset($result[$name])) { |
|
105 | + foreach ($proto as $name){ |
|
106 | + if (!isset($result[$name])){ |
|
107 | 107 | $result[$name] = $this->getRegistry()->resolveProperty($name); |
108 | 108 | } |
109 | 109 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | private function reverse(array $results): \Generator |
122 | 122 | { |
123 | - foreach (\array_reverse($results) as $result) { |
|
123 | + foreach (\array_reverse($results) as $result){ |
|
124 | 124 | yield from $result; |
125 | 125 | } |
126 | 126 | } |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | $results = [$this->readProperties($class)]; |
35 | 35 | |
36 | 36 | $parent = $class->getParentClass(); |
37 | - while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])) { |
|
37 | + while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])) |
|
38 | + { |
|
38 | 39 | $results[] = $this->readProperties($parent); |
39 | 40 | $parent = $parent->getParentClass(); |
40 | 41 | } |
@@ -67,8 +68,10 @@ discard block |
||
67 | 68 | { |
68 | 69 | $result = []; |
69 | 70 | |
70 | - foreach ($properties as $target) { |
|
71 | - if ($target instanceof Throwable) { |
|
71 | + foreach ($properties as $target) |
|
72 | + { |
|
73 | + if ($target instanceof Throwable) |
|
74 | + { |
|
72 | 75 | $result[] = \sprintf( |
73 | 76 | '<fg=red>%s [f: %s, l: %s]</fg=red>', |
74 | 77 | $target->getMessage(), |
@@ -78,7 +81,8 @@ discard block |
||
78 | 81 | continue; |
79 | 82 | } |
80 | 83 | |
81 | - if ($target === null) { |
|
84 | + if ($target === null) |
|
85 | + { |
|
82 | 86 | $result[] = '<fg=yellow>undefined</fg=yellow>'; |
83 | 87 | continue; |
84 | 88 | } |
@@ -94,16 +98,21 @@ discard block |
||
94 | 98 | */ |
95 | 99 | private function readProperties(\ReflectionClass $class): array |
96 | 100 | { |
97 | - if (isset($this->cache[$class->getFileName()])) { |
|
101 | + if (isset($this->cache[$class->getFileName()])) |
|
102 | + { |
|
98 | 103 | $proto = $this->cache[$class->getFileName()]; |
99 | - } else { |
|
104 | + } |
|
105 | + else |
|
106 | + { |
|
100 | 107 | $proto = $this->getExtractor()->getPrototypeProperties(\file_get_contents($class->getFileName())); |
101 | 108 | $this->cache[$class->getFileName()] = $proto; |
102 | 109 | } |
103 | 110 | |
104 | 111 | $result = []; |
105 | - foreach ($proto as $name) { |
|
106 | - if (!isset($result[$name])) { |
|
112 | + foreach ($proto as $name) |
|
113 | + { |
|
114 | + if (!isset($result[$name])) |
|
115 | + { |
|
107 | 116 | $result[$name] = $this->getRegistry()->resolveProperty($name); |
108 | 117 | } |
109 | 118 | } |
@@ -120,7 +129,8 @@ discard block |
||
120 | 129 | */ |
121 | 130 | private function reverse(array $results): \Generator |
122 | 131 | { |
123 | - foreach (\array_reverse($results) as $result) { |
|
132 | + foreach (\array_reverse($results) as $result) |
|
133 | + { |
|
124 | 134 | yield from $result; |
125 | 135 | } |
126 | 136 | } |