Passed
Branch master (17e5cc)
by Gaetano
01:47
created

Prototypeable::addMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 1
eloc 1
c 2
b 1
f 1
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace skrtdev\Prototypes;
4
5
use Closure;
6
7
trait Prototypeable{
8
9
    /**
10
     * @param string $name
11
     * @param array $args
12
     * @return mixed
13
     */
14
    public function __call(string $name, array $args)
15
    {
16
        return Prototypes::call($this, $name, $args);
17
    }
18
19
    /**
20
     * @param string $name
21
     * @param Closure $fun
22
     * @throws Exception
23
     */
24
    final public static function addMethod(string $name, Closure $fun): void
25
    {
26
        Prototypes::addClassMethod(static::class, $name, $fun);
27
    }
28
29
    /**
30
     * @param string $name
31
     * @param array $args
32
     * @return mixed
33
     */
34
    public static function __callStatic(string $name, array $args)
35
    {
36
        return Prototypes::callStatic(static::class, $name, $args);
37
    }
38
39
    /**
40
     * @param string $name
41
     * @param Closure $fun
42
     * @throws Exception
43
     */
44
    final public static function addStaticMethod(string $name, Closure $fun): void
45
    {
46
        Prototypes::addClassStaticMethod(static::class, $name, $fun);
47
    }
48
}
49
50