Eris\Generator\SequenceGenerator::shrink PHP Method

shrink() public method

public shrink ( GeneratedValue $sequence )
$sequence GeneratedValue
    public function shrink(GeneratedValue $sequence)
    {
        if (!$this->contains($sequence)) {
            throw new DomainException('Cannot shrink {' . var_export($sequence, true) . '} because ' . 'it does not belong to the domain of this sequence');
        }
        // TODO: make deterministic, try first one then the other?
        $willShrinkInSize = (new BooleanGenerator())->__invoke(1, 'rand');
        if ($willShrinkInSize) {
            return $this->shrinkInSize($sequence);
        }
        if (!$willShrinkInSize) {
            return $this->shrinkTheElements($sequence);
        }
    }