WebDependencyProvider::addRoutingFacade()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Web;
5
6
7
use Xervice\Core\Business\Model\Dependency\DependencyContainerInterface;
8
use Xervice\Core\Business\Model\Dependency\Provider\AbstractDependencyProvider;
9
use Xervice\Web\Business\Dependency\Plugin\PluginCollection;
10
11
class WebDependencyProvider extends AbstractDependencyProvider
12
{
13
    public const ROUTE_PROVIDER_COLLECTION = 'route.provider.collection';
14
15
    public const ROUTING_FACADE = 'routing.facade';
16
17
    /**
18
     * @param DependencyContainerInterface $container
19
     *
20
     * @return DependencyContainerInterface
21
     */
22 1
    public function handleDependencies(DependencyContainerInterface $container): DependencyContainerInterface
23
    {
24 1
        $container = $this->addPluginCollection($container);
25 1
        $container = $this->addRoutingFacade($container);
26
27 1
        return $container;
28
    }
29
30
    /**
31
     * @return \Xervice\Web\Business\Dependency\Plugin\WebProviderPluginInterface[]
32
     */
33
    protected function getRouteProvider(): array
34
    {
35
        return [];
36
    }
37
38
    /**
39
     * @param \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface $container
40
     *
41
     * @return \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface
42
     */
43 1
    protected function addPluginCollection(
44
        DependencyContainerInterface $container
45
    ): DependencyContainerInterface {
46
        $container[self::ROUTE_PROVIDER_COLLECTION] = function () {
47
            return new PluginCollection(
48
                $this->getRouteProvider()
49
            );
50
        };
51 1
        return $container;
52
    }
53
54
    /**
55
     * @param \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface $container
56
     *
57
     * @return \Xervice\Core\Business\Model\Dependency\DependencyContainerInterface
58
     */
59 1
    protected function addRoutingFacade(
60
        DependencyContainerInterface $container
61
    ): DependencyContainerInterface {
62
        $container[self::ROUTING_FACADE] = function (DependencyContainerInterface $container) {
63 1
            return $container->getLocator()->routing()->facade();
0 ignored issues
show
Bug introduced by
The method facade() does not exist on Xervice\Core\Business\Mo...y\LocatorProxyInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Xervice\Core\Business\Mo...xy\AbstractLocatorProxy or Xervice\Core\Business\Mo...PersistenceLocatorProxy. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
            return $container->getLocator()->routing()->/** @scrutinizer ignore-call */ facade();
Loading history...
64
        };
65 1
        return $container;
66
    }
67
}
68