REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 3.22 KB
Close
/opt/cpanel/ea-wappspector/vendor/rector/rector/src/Configuration/ConfigInitializer.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\Configuration; use RectorPrefix202411\Nette\Utils\FileSystem; use Rector\Contract\Rector\RectorInterface; use Rector\FileSystem\InitFilePathsResolver; use Rector\PostRector\Contract\Rector\PostRectorInterface; use RectorPrefix202411\Symfony\Component\Console\Style\SymfonyStyle; final class ConfigInitializer { /** * @var RectorInterface[] * @readonly */ private $rectors; /** * @readonly * @var \Rector\FileSystem\InitFilePathsResolver */ private $initFilePathsResolver; /** * @readonly * @var \Symfony\Component\Console\Style\SymfonyStyle */ private $symfonyStyle; /** * @param RectorInterface[] $rectors */ public function __construct(array $rectors, InitFilePathsResolver $initFilePathsResolver, SymfonyStyle $symfonyStyle) { $this->rectors = $rectors; $this->initFilePathsResolver = $initFilePathsResolver; $this->symfonyStyle = $symfonyStyle; } public function createConfig(string $projectDirectory) : void { $commonRectorConfigPath = $projectDirectory . '/rector.php'; if (\file_exists($commonRectorConfigPath)) { $this->symfonyStyle->warning('Register rules or sets in your "rector.php" config'); return; } $response = $this->symfonyStyle->ask('No "rector.php" config found. Should we generate it for you?', 'yes'); // be tolerant about input if (!\in_array($response, ['yes', 'YES', 'y', 'Y'], \true)) { // okay, nothing we can do return; } $configContents = FileSystem::read(__DIR__ . '/../../templates/rector.php.dist'); $configContents = $this->replacePathsContents($configContents, $projectDirectory); FileSystem::write($commonRectorConfigPath, $configContents, null); $this->symfonyStyle->success('The config is added now. Re-run command to make Rector do the work!'); } public function areSomeRectorsLoaded() : bool { $activeRectors = $this->filterActiveRectors($this->rectors); return $activeRectors !== []; } /** * @param RectorInterface[] $rectors * @return RectorInterface[] */ private function filterActiveRectors(array $rectors) : array { return \array_filter($rectors, static function (RectorInterface $rector) : bool { return !$rector instanceof PostRectorInterface; }); } private function replacePathsContents(string $rectorPhpTemplateContents, string $projectDirectory) : string { $projectPhpDirectories = $this->initFilePathsResolver->resolve($projectDirectory); // fallback to default 'src' in case of empty one if ($projectPhpDirectories === []) { $projectPhpDirectories[] = 'src'; } $projectPhpDirectoriesContents = ''; foreach ($projectPhpDirectories as $projectPhpDirectory) { $projectPhpDirectoriesContents .= " __DIR__ . '/" . $projectPhpDirectory . "'," . \PHP_EOL; } $projectPhpDirectoriesContents = \rtrim($projectPhpDirectoriesContents); return \str_replace('__PATHS__', $projectPhpDirectoriesContents, $rectorPhpTemplateContents); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 3 × Files: 7
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Deprecation
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Levels
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Parameter
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ConfigInitializer.php
3.22 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ConfigurationFactory.php
4.56 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Option.php
6.79 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PhpLevelSetResolver.php
1.49 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RectorConfigBuilder.php
29.70 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RenamedClassesDataCollector.php
1.55 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
VendorMissAnalyseGuard.php
1.33 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).