src/Instantiator.php
public function instantiate($className, array $data = [])
    {
        $refl = new \ReflectionClass($className);

        $instanceArgs = [];

        if ($data) {
            $instanceArgs = $this->extractArguments($refl->getConstructor()->getParameters(), $data);
        }

        return $refl->newInstanceArgs($instanceArgs);
    }
public function instantiate($className, array $data = [])
    {
        $refl = new \ReflectionClass($className);

        $instanceArgs = [];

        if ($data) {
            $instanceArgs = $this->extractArguments($refl->getConstructor()->getParameters(), $data);
        }

        return $refl->newInstanceArgs($instanceArgs);
    }
Instantiates the given class with the given data.

@param string $className
@param array $data
@return object