Passed
Push — main ( 8323f1...dd18c2 )
by Thierry
02:18
created

AbstractFacade::_getServiceWithContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Lagdo\Symfony\Facades;
4
5
abstract class AbstractFacade
6
{
7
    /**
8
     * @var mixed
9
     */
10
    protected static $service = null;
11
12
    /**
13
     * Get the service id.
14
     *
15
     * @return string
16
     */
17
    abstract protected static function getServiceIdentifier();
18
19
    /**
20
     * Call the service.
21
     *
22
     * @param string $method
23
     * @param array  $arguments
24
     *
25
     * @return mixed
26
     */
27
    public static function __callStatic($method, $arguments)
28
    {
29
        if(static::$service === null)
30
        {
31
            static::$service = Container::getService(static::getServiceIdentifier());
32
        }
33
        return \call_user_func_array([static::$service, $method], $arguments);
34
    }
35
}
36