Completed
Push — 1.x ( a98302...e42f79 )
by Alexander
07:32
created

DynamicMethodsDemo   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 24
rs 10
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2014, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Demo\Example;
12
13
/**
14
 * Example class to show how to intercept magic methods
15
 *
16
 * @method void saveById(int $id)
17
 * @method void saveByName(string $name)
18
 * @method void load(int $id)
19
 * @method static void find(array $args)
20
 */
21
class DynamicMethodsDemo
22
{
23
    /**
24
     * Magic invoker
25
     *
26
     * @param string $name Method name
27
     * @param array $args Method arguments
28
     */
29
    public function __call($name, array $args)
30
    {
31
        echo "I'm method: {$name}", PHP_EOL;
32
    }
33
34
    /**
35
     * Magic static invoker
36
     *
37
     * @param string $name Method name
38
     * @param array $args Method arguments
39
     */
40
    public static function __callStatic($name, array $args)
41
    {
42
        echo "I'm static method: {$name}", PHP_EOL;
43
    }
44
}
45