public function createInstanceFor($constraintName)
    {
        if (!isset($this->constraintMap[$constraintName])) {
            throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
        }

        if (!isset($this->instanceCache[$constraintName])) {
            $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
        }

        return clone $this->instanceCache[$constraintName];
    }
public function createInstanceFor($constraintName)
    {
        if (!isset($this->constraintMap[$constraintName])) {
            throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
        }

        if (!isset($this->instanceCache[$constraintName])) {
            $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
        }

        return clone $this->instanceCache[$constraintName];
    }
public function createInstanceFor ( $ constraintName ) { if ( ! isset ( $ this -> constraintMap [ $ constraintName ] ) ) { throw new InvalidArgumentException ( 'Unknown constraint ' . $ constraintName ) ; } if ( ! isset ( $ this -> instanceCache [ $ constraintName ] ) ) { $ this -> instanceCache [ $ constraintName ] = new $ this -> constraintMap [ $ constraintName ] ( $ this ) ; } return clone $ this -> instanceCache [ $ constraintName ] ; }
Create a constraint instance for the given constraint name.

@param string $constraintName

@throws InvalidArgumentException if is not possible create the constraint instance

@return ConstraintInterface|ObjectConstraint
Create a constraint instance for the given constraint name .