| @@ 35-62 (lines=28) @@ | ||
| 32 | /** |
|
| 33 | * @param TaisiyaStyle $io |
|
| 34 | */ |
|
| 35 | final protected function rebuildComposerSubscribersCache(TaisiyaStyle $io): void |
|
| 36 | { |
|
| 37 | $io->isVerbose() && $io->writeln('Rebuild Composer subscribers cache'); |
|
| 38 | ||
| 39 | $subscribers = []; |
|
| 40 | ||
| 41 | $finder = Finder::create() |
|
| 42 | ->in(TAISIYA_ROOT) |
|
| 43 | ->path('/(src|vendor)/') |
|
| 44 | ->files() |
|
| 45 | ->name('*Subscriber.php'); |
|
| 46 | ||
| 47 | foreach ($finder as $k => $file) { |
|
| 48 | $subscriberClass = $this->extractClassNameFromFile($file->getPathname()); |
|
| 49 | try { |
|
| 50 | $reflectionClass = new \ReflectionClass($subscriberClass); |
|
| 51 | } catch (\ReflectionException $e) { |
|
| 52 | continue; |
|
| 53 | } |
|
| 54 | if (!$reflectionClass->isAbstract() && $reflectionClass->isSubclassOf(EventSubscriberInterface::class)) { |
|
| 55 | $io->isVerbose() && $io->writeln(' + '.$subscriberClass); |
|
| 56 | $subscribers[] = $subscriberClass; |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| 60 | $this->putDataToCacheFile('composer_subscribers.cache.php', $subscribers); |
|
| 61 | $io->isVerbose() && $io->writeln(' Subscribers saved to <info>composer_subscribers.cache.php</info>'); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @param TaisiyaStyle $io |
|
| @@ 67-90 (lines=24) @@ | ||
| 64 | /** |
|
| 65 | * @param TaisiyaStyle $io |
|
| 66 | */ |
|
| 67 | final protected function rebuildBundlesCache(TaisiyaStyle $io): void |
|
| 68 | { |
|
| 69 | $io->isVerbose() && $io->writeln('Rebuild bundles cache'); |
|
| 70 | ||
| 71 | $bundles = []; |
|
| 72 | ||
| 73 | $finder = Finder::create() |
|
| 74 | ->in(TAISIYA_ROOT) |
|
| 75 | ->path('/(src|vendor)/') |
|
| 76 | ->files() |
|
| 77 | ->name('*ServiceProvider.php'); |
|
| 78 | ||
| 79 | foreach ($finder as $k => $file) { |
|
| 80 | $bundleServiceProvider = $this->extractClassNameFromFile($file->getPathname()); |
|
| 81 | $reflectionClass = new \ReflectionClass($bundleServiceProvider); |
|
| 82 | if (!$reflectionClass->isAbstract() && $reflectionClass->isSubclassOf(ServiceProvider::class)) { |
|
| 83 | $io->isVerbose() && $io->writeln(' + '.$bundleServiceProvider); |
|
| 84 | $bundles[] = $bundleServiceProvider; |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | $this->putDataToCacheFile('bundles.cache.php', $bundles); |
|
| 89 | $io->isVerbose() && $io->writeln(' Bundles saved to <info>bundles.cache.php</info>'); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @param TaisiyaStyle $io |
|
| @@ 95-122 (lines=28) @@ | ||
| 92 | /** |
|
| 93 | * @param TaisiyaStyle $io |
|
| 94 | */ |
|
| 95 | final protected function rebuildCommandsCache(TaisiyaStyle $io): void |
|
| 96 | { |
|
| 97 | $io->isVerbose() && $io->writeln('Rebuild commands cache'); |
|
| 98 | ||
| 99 | $commands = []; |
|
| 100 | ||
| 101 | $finder = Finder::create() |
|
| 102 | ->in(TAISIYA_ROOT) |
|
| 103 | ->path('/(src|vendor)/') |
|
| 104 | ->files() |
|
| 105 | ->name('*Command.php'); |
|
| 106 | ||
| 107 | foreach ($finder as $k => $file) { |
|
| 108 | $commandClass = $this->extractClassNameFromFile($file->getPathname()); |
|
| 109 | try { |
|
| 110 | $reflectionClass = new \ReflectionClass($commandClass); |
|
| 111 | } catch (\ReflectionException $e) { |
|
| 112 | continue; |
|
| 113 | } |
|
| 114 | if (!$reflectionClass->isAbstract() && $reflectionClass->isSubclassOf(Command::class)) { |
|
| 115 | $io->isVerbose() && $io->writeln(' + '.$commandClass); |
|
| 116 | $commands[] = $commandClass; |
|
| 117 | } |
|
| 118 | } |
|
| 119 | ||
| 120 | $this->putDataToCacheFile('commands.cache.php', $commands); |
|
| 121 | $io->isVerbose() && $io->writeln(' Commands saved to <info>commands.cache.php</info>'); |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * @param string $filepath |
|