Page MenuHomeWickedGov Phorge

ConstantGenerator.php
No OneTemporary

Size
858 B
Referenced Files
None
Subscribers
None

ConstantGenerator.php

<?php
namespace Eris\Generator;
use Eris\Generator;
use Eris\Generators;
use Eris\Random\RandomRange;
/**
* @param mixed $value the only value to generate
* @return ConstantGenerator
*/
function constant($value)
{
return Generators::constant($value);
}
/**
* @psalm-template T
* @template-implements Generator<T>
*/
class ConstantGenerator implements Generator
{
private $value;
public static function box($value)
{
return new self($value);
}
public function __construct($value)
{
$this->value = $value;
}
public function __invoke($_size, RandomRange $rand)
{
return GeneratedValueSingle::fromJustValue($this->value, 'constant');
}
public function shrink(GeneratedValue $element)
{
return GeneratedValueSingle::fromJustValue($this->value, 'constant');
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Nov 22, 03:01 (1 d, 10 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8d/da/b260b6b498e5a1e3ffb73b977bb6
Default Alt Text
ConstantGenerator.php (858 B)

Event Timeline