This commit is contained in:
2025-11-20 16:34:30 +01:00
parent 15d1a30e88
commit 4e4351e833
631 changed files with 130125 additions and 36318 deletions

View File

@@ -8,6 +8,7 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version Build @@version@@
*/
/**
* The Mixer strategy interface.
*
@@ -38,32 +39,40 @@ namespace RandomLibtest\Mocks\Random;
class Generator extends \RandomLib\Generator
{
protected $callbacks = array();
public static function init()
{
}
public function __construct(array $callbacks = array())
{
$this->callbacks = $callbacks;
}
public function __call($name, array $args = array())
{
if (isset($this->callbacks[$name])) {
return call_user_func_array($this->callbacks[$name], $args);
}
return null;
}
public function addSource(\PasswordLib\Random\Source $source)
{
return $this->__call('addSource', array($source));
}
public function generate($size)
{
return $this->__call('generate', array($size));
}
public function generateInt($min = 0, $max = \PHP_INT_MAX)
{
return $this->__call('generateInt', array($min, $max));
}
public function generateString($length, $chars = '')
{
return $this->__call('generateString', array($length, $chars));

View File

@@ -8,6 +8,7 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version Build @@version@@
*/
/**
* The Mixer strategy interface.
*
@@ -26,6 +27,7 @@
namespace RandomLibtest\Mocks\Random;
use SecurityLib\Strength;
/**
* The Mixer strategy interface.
*
@@ -39,12 +41,15 @@ use SecurityLib\Strength;
class Mixer extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Mixer
{
public static $strength = null;
public static $test = \true;
public static $test = true;
public static function init()
{
static::$strength = new Strength(Strength::HIGH);
static::$test = \true;
static::$test = true;
}
/**
* Return an instance of Strength indicating the strength of the mixer
*
@@ -54,6 +59,7 @@ class Mixer extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Mixe
{
return static::$strength;
}
/**
* Test to see if the mixer is available
*
@@ -63,6 +69,7 @@ class Mixer extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Mixe
{
return static::$test;
}
/**
* Mix the provided array of strings into a single output of the same size
*

View File

@@ -8,6 +8,7 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version Build @@version@@
*/
/**
* The Random Number Source interface.
*
@@ -26,6 +27,7 @@
namespace RandomLibtest\Mocks\Random;
use SecurityLib\Strength;
/**
* The Random Number Source interface.
*
@@ -39,10 +41,12 @@ use SecurityLib\Strength;
class Source extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Source
{
public static $strength = null;
public static function init()
{
static::$strength = new Strength(Strength::VERYLOW);
}
/**
* Return an instance of Strength indicating the strength of the source
*
@@ -52,6 +56,7 @@ class Source extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Sou
{
return static::$strength;
}
/**
* If the source is currently available.
* Reasons might be because the library is not installed
@@ -60,8 +65,9 @@ class Source extends \RandomLibTest\Mocks\AbstractMock implements \RandomLib\Sou
*/
public static function isSupported()
{
return \true;
return true;
}
/**
* Generate a random string of the specified size
*