Prototypeable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 5
c 2
b 1
f 1
dl 0
loc 40
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addMethod() 0 3 1
A __call() 0 3 1
A __callStatic() 0 3 1
A addStaticMethod() 0 3 1
1
<?php
2
3
namespace skrtdev\Prototypes;
4
5
trait Prototypeable{
6
7
    /**
8
     * @param string $name
9
     * @param array $args
10
     * @return mixed
11
     */
12
    public function __call(string $name, array $args)
13
    {
14
        return Prototypes::call($this, $name, $args);
15
    }
16
17
    /**
18
     * @param string $name
19
     * @param callable $fun
20
     * @throws Exception
21
     */
22
    public static function addMethod(string $name, callable $fun): void
23
    {
24
        Prototypes::addClassMethod(static::class, $name, $fun);
25
    }
26
27
    /**
28
     * @param string $name
29
     * @param array $args
30
     * @return mixed
31
     */
32
    public static function __callStatic(string $name, array $args)
33
    {
34
        return Prototypes::callStatic(static::class, $name, $args);
35
    }
36
37
    /**
38
     * @param string $name
39
     * @param callable $fun
40
     * @throws Exception
41
     */
42
    public static function addStaticMethod(string $name, callable $fun): void
43
    {
44
        Prototypes::addClassStaticMethod(static::class, $name, $fun);
45
    }
46
}
47
48