| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | trait InterfaceMethodCreator |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Resolves dependency from an interface factory method. Factory method name is formed from the |
||
| 13 | * interface name through converting it to a valid camel-case identifier. For example, |
||
| 14 | * to create \Monolog\Logger for \Psr\Log\LoggerInterface dependency use this: |
||
| 15 | * |
||
| 16 | * public function psrLogLoggerInterface() { |
||
| 17 | * return new \Monolog\Logger('channelname'); |
||
| 18 | * } |
||
| 19 | * |
||
| 20 | * @param string $name Name of the interface to be created |
||
| 21 | * @return Bean|null New $name instance or null if no such class |
||
|
|
|||
| 22 | * @throws NotTheRequestedInterface if the created instance is not a $name |
||
| 23 | */ |
||
| 24 | protected function fromInterfaceMethod(string $name) { |
||
| 25 | if (interface_exists($name, true) === false) |
||
| 26 | return null; |
||
| 27 | |||
| 28 | $bean = $this->fromMethod($this->interfaceToFactory($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 camel-case method name: |
||
| 41 | * \Psr\Log\LoggerInterface => psrLogLoggerInterface |
||
| 42 | */ |
||
| 43 | private function interfaceToFactory(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