1 | <?php |
||
30 | class Source extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Source { |
||
31 | |||
32 | public static $strength = null; |
||
33 | |||
34 | public static function init() { |
||
35 | static::$strength = new Strength(Strength::VERYLOW); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Return an instance of Strength indicating the strength of the source |
||
40 | * |
||
41 | * @return Strength An instance of one of the strength classes |
||
42 | */ |
||
43 | public static function getStrength() { |
||
44 | return static::$strength; |
||
45 | } |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Generate a random string of the specified size |
||
50 | * |
||
51 | * Note: If the source fails to generate enough data, the result must be |
||
52 | * padded to the requested length. |
||
53 | * |
||
54 | * @param int $size The size of the requested random string |
||
55 | * |
||
56 | * @return string A string of the requested size |
||
57 | */ |
||
58 | public function generate($size) { |
||
59 | return $this->__call('generate', array($size)); |
||
60 | } |
||
61 | |||
62 | } |
||
63 | |||
65 |