ContainerWrapper::getFacadeService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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