@@ 71-94 (lines=24) @@ | ||
68 | /** |
|
69 | * @param TaisiyaStyle $io |
|
70 | */ |
|
71 | final protected function rebuildBundlesCache(TaisiyaStyle $io): void |
|
72 | { |
|
73 | $io->isVerbose() && $io->writeln('Rebuild bundles cache'); |
|
74 | ||
75 | $bundles = []; |
|
76 | ||
77 | $finder = Finder::create() |
|
78 | ->in(TAISIYA_ROOT) |
|
79 | ->path('/(src|vendor)/') |
|
80 | ->files() |
|
81 | ->name('*ServiceProvider.php'); |
|
82 | ||
83 | foreach ($finder as $k => $file) { |
|
84 | $bundleServiceProvider = $this->extractClassNameFromFile($file->getPathname()); |
|
85 | $reflectionClass = new \ReflectionClass($bundleServiceProvider); |
|
86 | if (!$reflectionClass->isAbstract() && $reflectionClass->isSubclassOf(ServiceProvider::class)) { |
|
87 | $io->isVerbose() && $io->writeln(' + '.$bundleServiceProvider); |
|
88 | $bundles[] = $bundleServiceProvider; |
|
89 | } |
|
90 | } |
|
91 | ||
92 | $this->putDataToCacheFile('bundles.cache.php', $bundles); |
|
93 | $io->isVerbose() && $io->writeln(' Bundles saved to <info>bundles.cache.php</info>'); |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * @param TaisiyaStyle $io |
|
@@ 99-126 (lines=28) @@ | ||
96 | /** |
|
97 | * @param TaisiyaStyle $io |
|
98 | */ |
|
99 | final protected function rebuildCommandsCache(TaisiyaStyle $io): void |
|
100 | { |
|
101 | $io->isVerbose() && $io->writeln('Rebuild commands cache'); |
|
102 | ||
103 | $commands = []; |
|
104 | ||
105 | $finder = Finder::create() |
|
106 | ->in(TAISIYA_ROOT) |
|
107 | ->path('/(src|vendor)/') |
|
108 | ->files() |
|
109 | ->name('*Command.php'); |
|
110 | ||
111 | foreach ($finder as $k => $file) { |
|
112 | $commandClass = $this->extractClassNameFromFile($file->getPathname()); |
|
113 | try { |
|
114 | $reflectionClass = new \ReflectionClass($commandClass); |
|
115 | } catch (\ReflectionException $e) { |
|
116 | continue; |
|
117 | } |
|
118 | if (!$reflectionClass->isAbstract() && $reflectionClass->isSubclassOf(Command::class)) { |
|
119 | $io->isVerbose() && $io->writeln(' + '.$commandClass); |
|
120 | $commands[] = $commandClass; |
|
121 | } |
|
122 | } |
|
123 | ||
124 | $this->putDataToCacheFile('commands.cache.php', $commands); |
|
125 | $io->isVerbose() && $io->writeln(' Commands saved to <info>commands.cache.php</info>'); |
|
126 | } |
|
127 | ||
128 | /** |
|
129 | * @param string $filepath |