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

Mixer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A getStrength() 0 4 1
A test() 0 4 1
A mix() 0 4 1
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 Mixer strategy interface.
14
 *
15
 * All mixing strategies must implement this interface
16
 *
17
 * PHP version 5.3
18
 *
19
 * @category   PHPPasswordLib
20
 * @package    Random
21
 *
22
 * @author     Anthony Ferrara <[email protected]>
23
 * @copyright  2011 The Authors
24
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
25
 * @license    http://www.gnu.org/licenses/lgpl-2.1.html LGPL v 2.1
26
 */
27
namespace RandomLibtest\Mocks\Random;
28
29
use SecurityLib\Strength;
30
31
/**
32
 * The Mixer strategy interface.
33
 *
34
 * All mixing strategies must implement this interface
35
 *
36
 * @category   PHPPasswordLib
37
 * @package    Random
38
 *
39
 * @author     Anthony Ferrara <[email protected]>
40
 */
41
class Mixer extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Mixer
42
{
43
    public static $strength = null;
44
45
    public static $test = true;
46
47
    public static function init()
48
    {
49
        static::$strength = new Strength(Strength::HIGH);
50
        static::$test = true;
51
    }
52
53
    /**
54
     * Return an instance of Strength indicating the strength of the mixer
55
     *
56
     * @return \SecurityLib\Strength An instance of one of the strength classes
57
     */
58
    public static function getStrength()
59
    {
60
        return static::$strength;
61
    }
62
63
    /**
64
     * Test to see if the mixer is available
65
     *
66
     * @return bool If the mixer is available on the system
67
     */
68
    public static function test()
69
    {
70
        return static::$test;
71
    }
72
73
    /**
74
     * Mix the provided array of strings into a single output of the same size
75
     *
76
     * All elements of the array should be the same size.
77
     *
78
     * @param array $parts The parts to be mixed
79
     *
80
     * @return string The mixed result
81
     */
82
    public function mix(array $parts)
83
    {
84
        return $this->__call('mix', array($parts));
85
    }
86
}
87