|
@@ 43-66 (lines=24) @@
|
| 40 |
|
/** |
| 41 |
|
* @param TaisiyaStyle $io |
| 42 |
|
*/ |
| 43 |
|
final protected function rebuildEventsSubscribersCache(InputInterface $input, OutputInterface $output): void |
| 44 |
|
{ |
| 45 |
|
$output->isVerbose() && $output->writeln('Rebuild events subscribers cache'); |
| 46 |
|
|
| 47 |
|
$bundles = []; |
| 48 |
|
|
| 49 |
|
$finder = Finder::create() |
| 50 |
|
->in(TAISIYA_ROOT) |
| 51 |
|
->path('/(src|vendor)/') |
| 52 |
|
->files() |
| 53 |
|
->name('*Subscriber.php'); |
| 54 |
|
|
| 55 |
|
foreach ($finder as $k => $file) { |
| 56 |
|
$bundleServiceProvider = $this->extractClassNameFromFile($file->getPathname()); |
| 57 |
|
$reflectionClass = new \ReflectionClass($bundleServiceProvider); |
| 58 |
|
if (!$reflectionClass->isAbstract() && $reflectionClass->isSubclassOf(EventSubscriberInterface::class)) { |
| 59 |
|
$output->isVerbose() && $output->writeln(' + '.$bundleServiceProvider); |
| 60 |
|
$bundles[] = $bundleServiceProvider; |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
$this->putDataToCacheFile('events_subscribers.cache.php', $bundles); |
| 65 |
|
$output->isVerbose() && $output->writeln(' Subscribers saved to <info>events_subscribers.cache.php</info>'); |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
/** |
| 69 |
|
* @param TaisiyaStyle $io |
|
@@ 71-94 (lines=24) @@
|
| 68 |
|
/** |
| 69 |
|
* @param TaisiyaStyle $io |
| 70 |
|
*/ |
| 71 |
|
final protected function rebuildBundlesCache(InputInterface $input, OutputInterface $output): void |
| 72 |
|
{ |
| 73 |
|
$output->isVerbose() && $output->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 |
|
$output->isVerbose() && $output->writeln(' + '.$bundleServiceProvider); |
| 88 |
|
$bundles[] = $bundleServiceProvider; |
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
$this->putDataToCacheFile('bundles.cache.php', $bundles); |
| 93 |
|
$output->isVerbose() && $output->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(InputInterface $input, OutputInterface $output): void |
| 100 |
|
{ |
| 101 |
|
$output->isVerbose() && $output->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 |
|
$output->isVerbose() && $output->writeln(' + '.$commandClass); |
| 120 |
|
$commands[] = $commandClass; |
| 121 |
|
} |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
$this->putDataToCacheFile('commands.cache.php', $commands); |
| 125 |
|
$output->isVerbose() && $output->writeln(' Commands saved to <info>commands.cache.php</info>'); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
/** |
| 129 |
|
* @param string $filepath |