Nelmio\Alice\Generator\Resolver\UniqueValuesPool::has PHP Method

has() public method

public has ( UniqueValue $value ) : boolean
$value Nelmio\Alice\Definition\Value\UniqueValue
return boolean
    public function has(UniqueValue $value) : bool
    {
        $valueId = $value->getId();
        if (false === array_key_exists($valueId, $this->pool)) {
            return false;
        }
        return $this->hasIdenticalValueInCache($valueId, $value->getValue());
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  *
  * @param UniqueValue $value
  *
  * @throws UniqueValueGenerationLimitReachedException
  */
 public function resolve(ValueInterface $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context, int $tryCounter = 0) : ResolvedValueWithFixtureSet
 {
     $this->checkResolver(__METHOD__);
     $tryCounter = $this->incrementCounter($tryCounter, $value, $this->limit);
     /**
      * @var UniqueValue        $generatedValue
      * @var ResolvedFixtureSet $fixtureSet
      */
     list($generatedValue, $fixtureSet) = $this->generateValue($value, $fixture, $fixtureSet, $scope, $context);
     if ($this->pool->has($generatedValue)) {
         return $this->resolve($value, $fixture, $fixtureSet, $scope, $context, $tryCounter);
     }
     $this->pool->add($generatedValue);
     return new ResolvedValueWithFixtureSet($generatedValue->getValue(), $fixtureSet);
 }
All Usage Examples Of Nelmio\Alice\Generator\Resolver\UniqueValuesPool::has