VariationFactory.php
public function createNew(string $name, array $parameters)
    {
        if (!$this->configResolver instanceof ConfigResolver) {
            $this->configResolver = $this->getResolver();
        }

        if (!isset($this->map[$parameters['type']])) {
            throw new \InvalidArgumentException(sprintf('Variation type %s is not valid', $parameters['type']));
        }
        $class = $this->map[$parameters['type']];
        $class::validateParameters($parameters);

        return new $class($name, $parameters, $this->configResolver);
    }
public function createNew(string $name, array $parameters)
    {
        if (!$this->configResolver instanceof ConfigResolver) {
            $this->configResolver = $this->getResolver();
        }

        if (!isset($this->map[$parameters['type']])) {
            throw new \InvalidArgumentException(sprintf('Variation type %s is not valid', $parameters['type']));
        }
        $class = $this->map[$parameters['type']];
        $class::validateParameters($parameters);

        return new $class($name, $parameters, $this->configResolver);
    }
public function createNew ( string $ name , array $ parameters ) { if ( ! $ this -> configResolver instanceof ConfigResolver ) { $ this -> configResolver = $ this -> getResolver ( ) ; } if ( ! isset ( $ this -> map [ $ parameters [ 'type' ] ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Variation type %s is not valid' , $ parameters [ 'type' ] ) ) ; } $ class = $ this -> map [ $ parameters [ 'type' ] ] ; $ class :: validateParameters ( $ parameters ) ; return new $ class ( $ name , $ parameters , $ this -> configResolver ) ; }
@param string $name
@param array  $parameters

@return AbstractVariation

@throws \InvalidArgumentException
@param string $name @param array $parameters