REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.72 KB
Close
/opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\Doctrine\CodeQuality; use PHPStan\Reflection\ReflectionProvider; use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping; use RectorPrefix202411\Symfony\Component\Finder\Finder; use RectorPrefix202411\Symfony\Component\Finder\SplFileInfo; use RectorPrefix202411\Symfony\Component\Yaml\Yaml; use RectorPrefix202411\Webmozart\Assert\Assert; final class EntityMappingResolver { /** * @readonly * @var \PHPStan\Reflection\ReflectionProvider */ private $reflectionProvider; /** * @var EntityMapping[] */ private $entityMappings = []; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; } /** * @param string[] $yamlMappingDirectories * @return EntityMapping[] */ public function resolveFromDirectories(array $yamlMappingDirectories) : array { Assert::allString($yamlMappingDirectories); if ($this->entityMappings !== []) { return $this->entityMappings; } $yamlFileInfos = $this->findYamlFileInfos($yamlMappingDirectories); Assert::notEmpty($yamlFileInfos); $this->entityMappings = $this->createEntityMappingsFromYamlFileInfos($yamlFileInfos); Assert::notEmpty($this->entityMappings); return $this->entityMappings; } /** * @param string[] $yamlMappingDirectories * @return SplFileInfo[] */ private function findYamlFileInfos(array $yamlMappingDirectories) : array { Assert::notEmpty($yamlMappingDirectories); Assert::allString($yamlMappingDirectories); Assert::allFileExists($yamlMappingDirectories); $finder = new Finder(); $finder->files()->name('#\\.(yml|yaml)$#')->in($yamlMappingDirectories)->notPath('DataFixtures')->getIterator(); return \iterator_to_array($finder->getIterator()); } /** * @param SplFileInfo[] $yamlFileInfos * @return EntityMapping[] */ private function createEntityMappingsFromYamlFileInfos(array $yamlFileInfos) : array { Assert::allIsInstanceOf($yamlFileInfos, SplFileInfo::class); $entityMappings = []; foreach ($yamlFileInfos as $yamlFileInfo) { // is a mapping file? $yaml = Yaml::parse($yamlFileInfo->getContents()); foreach ($yaml as $key => $value) { // for tests if (!$this->reflectionProvider->hasClass($key) && \strpos((string) $key, 'Rector\\Doctrine\\Tests\\CodeQuality') === \false) { continue; } $entityMappings[] = new EntityMapping($key, $value); } } return $entityMappings; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 8 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AttributeTransformer
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
Contract
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
Enum
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
Helper
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
NodeFactory
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
Rector
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
Utils
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
ValueObject
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
EntityMappingResolver.php
2.72 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
SetterCollectionResolver.php
4.51 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).