1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is part of Biurad opensource projects. |
||
7 | * |
||
8 | * PHP version 7.2 and above required |
||
9 | * |
||
10 | * @author Divine Niiquaye Ibok <[email protected]> |
||
11 | * @copyright 2019 Biurad Group (https://biurad.com/) |
||
12 | * @license https://opensource.org/licenses/BSD-3-Clause License |
||
13 | * |
||
14 | * For the full copyright and license information, please view the LICENSE |
||
15 | * file that was distributed with this source code. |
||
16 | */ |
||
17 | |||
18 | namespace Biurad\Cycle; |
||
19 | |||
20 | use Biurad\Http\ServerRequest; |
||
0 ignored issues
–
show
|
|||
21 | use Cycle\ORM\ORMInterface; |
||
22 | use Cycle\ORM\Schema; |
||
23 | use Cycle\ORM\Select; |
||
24 | use DivineNii\Invoker\Interfaces\ArgumentValueResolverInterface; |
||
0 ignored issues
–
show
The type
DivineNii\Invoker\Interf...tValueResolverInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
25 | use ReflectionClass; |
||
26 | use ReflectionParameter; |
||
27 | |||
28 | /** |
||
29 | * Find a role then Injects it into a repository class object, |
||
30 | * returning the repository class object. |
||
31 | * |
||
32 | * @author Divine Niiquaye Ibok <[email protected]> |
||
33 | */ |
||
34 | class RepositoryValueResolver implements ArgumentValueResolverInterface |
||
35 | { |
||
36 | /** @var ORMInterface */ |
||
37 | private $orm; |
||
38 | |||
39 | public function __construct(ORMInterface $orm) |
||
40 | { |
||
41 | $this->orm = $orm; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function resolve(ReflectionParameter $parameter, array $providedParameters) |
||
48 | { |
||
49 | $parameterType = $parameter->getType(); |
||
50 | |||
51 | if (!$parameterType instanceof \ReflectionNamedType || $parameterType->isBuiltin()) { |
||
52 | // No type, Primitive types and Union types are not supported |
||
53 | return; |
||
54 | } |
||
55 | |||
56 | $schema = $this->orm->getSchema(); |
||
57 | |||
58 | foreach ($schema->getRoles() as $role) { |
||
59 | $repository = $schema->define($role, Schema::REPOSITORY); |
||
60 | |||
61 | if ( |
||
62 | $repository !== Select\Repository::class |
||
63 | && $repository === $parameterType->getName() |
||
64 | ) { |
||
65 | return $this->orm->getRepository($role); |
||
66 | } |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 |
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