| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | trait InterfaceAliasCreator |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Resolves dependency from an interface alias. Alias is a class constant in the config class. |
||
| 14 | * Alias is formed by replacing backslashes in the interface name with underlines and converting |
||
| 15 | * it to uppercase. Value of the alias is a class name. For example to create \Monolog\Logger |
||
| 16 | * for a \Psr\Log\LoggerInterface dependency use this: |
||
| 17 | * |
||
| 18 | * const PSR_LOG_LOGGERINTERFACE = '\Monolog\Logger'; |
||
| 19 | * |
||
| 20 | * @param string $name Name of the interface to be created |
||
| 21 | * @return Bean|null Wrapped new $name instance or null if no such class |
||
|
|
|||
| 22 | * @throws NotTheRequestedInterface If the created instance is not a $name |
||
| 23 | */ |
||
| 24 | protected function fromInterfaceAlias(string $name) { |
||
| 25 | if (interface_exists($name, true) === false) |
||
| 26 | return null; |
||
| 27 | |||
| 28 | $bean = $this->fromClass($this->fromConst($this->interfaceToAlias($name))); |
||
| 29 | if ($bean === null) |
||
| 30 | return null; |
||
| 31 | |||
| 32 | if (is_subclass_of($bean->value, $name) === false) |
||
| 33 | throw new NotTheRequestedInterface(get_class($bean->value), $name); |
||
| 34 | |||
| 35 | $bean->addAlias($name); |
||
| 36 | return $bean; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Converts FQIN to a valid const name: |
||
| 41 | * Psr\Log\LoggerInterface => PSR_LOG_LOGGERINTERFACE |
||
| 42 | */ |
||
| 43 | private function interfaceToAlias(string $name) : string { |
||
| 45 | } |
||
| 46 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths