ContainerWrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFacadeService() 0 3 1
A setContainer() 0 3 1
1
<?php
2
3
namespace Lagdo\Facades;
4
5
use Psr\Container\ContainerExceptionInterface;
6
use Psr\Container\ContainerInterface;
7
use Psr\Container\NotFoundExceptionInterface;
8
9
final class ContainerWrapper
10
{
11
    /**
12
     * @var ContainerInterface
13
     */
14
    private static ContainerInterface $container;
15
16
    /**
17
     * @param ContainerInterface $container
18
     *
19
     * @return void
20
     */
21
    public static function setContainer(ContainerInterface $container): void
22
    {
23
        self::$container = $container;
24
    }
25
26
    /**
27
     * Get a service using the container.
28
     *
29
     * @param string $serviceId
30
     *
31
     * @return mixed
32
     * @throws ContainerExceptionInterface
33
     * @throws NotFoundExceptionInterface
34
     */
35
    public static function getFacadeService(string $serviceId): mixed
36
    {
37
        return self::$container->get($serviceId);
38
    }
39
}
40