| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class StaticClassMapSourceLocator extends AbstractSourceLocator |
||
| 17 | { |
||
| 18 | /** @var string[] */ |
||
| 19 | private $classMap; |
||
| 20 | |||
| 21 | /** @param string[] $classMap of class to file path. Every file must exist, every key must be non-empty */ |
||
| 22 | public function __construct( |
||
| 23 | array $classMap, |
||
| 24 | Locator $astLocator |
||
| 25 | ) { |
||
| 26 | parent::__construct($astLocator); |
||
| 27 | |||
| 28 | $realPaths = array_map('realpath', $classMap); |
||
| 29 | |||
| 30 | Assert::that($classMap)->all()->file(); |
||
| 31 | Assert::that(array_keys($classMap))->all()->string()->notEmpty(); |
||
| 32 | |||
| 33 | $this->classMap = $realPaths; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritDoc} |
||
| 38 | */ |
||
| 39 | protected function createLocatedSource(Identifier $identifier) : ?LocatedSource |
||
| 52 | } |
||
| 53 | } |
||
| 54 |