AbstractFacade   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A instance() 0 3 1
A __callStatic() 0 4 1
1
<?php
2
3
namespace Lagdo\Facades;
4
5
/**
6
 * @template Service of object
7
 * @mixin Service
8
 */
9
abstract class AbstractFacade
10
{
11
    /**
12
     * Get the service identifier.
13
     *
14
     * @return string
15
     */
16
    abstract protected static function getServiceIdentifier(): string;
17
18
    /**
19
     * Get the service instance.
20
     *
21
     * @return Service
22
     */
23
    public static function instance(): mixed
24
    {
25
        return ContainerWrapper::getFacadeService(static::getServiceIdentifier());
26
    }
27
28
    /**
29
     * Call the service.
30
     *
31
     * @param string $method
32
     * @param array  $arguments
33
     *
34
     * @return mixed
35
     */
36
    public static function __callStatic(string $method, array $arguments): mixed
37
    {
38
        // Get the instance and call the method.
39
        return self::instance()->$method(...$arguments);
40
    }
41
}
42