Completed
Push — master ( 247290...01d05f )
by Michael
08:30
created

AbstractMock::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 3
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * The RandomLib library for securely generating random numbers and strings in PHP
5
 *
6
 * @author     Anthony Ferrara <[email protected]>
7
 * @copyright  2011 The Authors
8
 * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
9
 * @version    Build @@version@@
10
 */
11
12
/**
13
 * The interface that all hash implementations must implement
14
 *
15
 * PHP version 5.3
16
 *
17
 * @category   PHPPasswordLib
18
 * @package    Hash
19
 *
20
 * @author     Anthony Ferrara <[email protected]>
21
 * @copyright  2011 The Authors
22
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
23
 * @license    http://www.gnu.org/licenses/lgpl-2.1.html LGPL v 2.1
24
 */
25
namespace RandomLibtest\Mocks;
26
27
/**
28
 * The interface that all hash implementations must implement
29
 *
30
 * @category   PHPPasswordLib
31
 * @package    Hash
32
 *
33
 * @author     Anthony Ferrara <[email protected]>
34
 */
35 View Code Duplication
class AbstractMock
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
{
37
    protected $callbacks = array();
38
39
    public static function init()
40
    {
41
    }
42
43
    public function __construct(array $callbacks = array())
44
    {
45
        $this->callbacks = $callbacks;
46
    }
47
48
    public function __call($name, array $args = array())
49
    {
50
        if (isset($this->callbacks[$name])) {
51
            return call_user_func_array($this->callbacks[$name], $args);
52
        }
53
54
        return null;
55
    }
56
}
57