Completed
Pull Request — master (#383)
by Anton
05:14
created

ProxyTrait::__callStatic()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 8
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 9.4285
c 1
b 0
f 0
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link https://github.com/bluzphp/framework
7
 */
8
9
/**
10
 * @namespace
11
 */
12
namespace Bluz\Proxy;
13
14
use Bluz\Common\Singleton;
15
16
/**
17
 * ProxyTrait
18
 *
19
 * @package  Bluz\Proxy
20
 * @author   Anton Shevchuk
21
 */
22
trait ProxyTrait
23
{
24
    use Singleton;
25
26
    /**
27
     * Handle dynamic, static calls to the object.
28
     *
29
     * @param  string $method
30
     * @param  array $args
31
     * @return mixed
32
     */
33 650
    public static function __callStatic($method, $args)
34
    {
35 650
        if ($instance = static::getInstance()) {
36 650
            return $instance->$method(...$args);
37
        } else {
38
            return false;
39
        }
40
    }
41
}
42