PhpSpec\Wrapper\Subject\WrappedObject::instantiateFromCallback PHP Method

instantiateFromCallback() private method

private instantiateFromCallback ( callable $factoryCallable ) : object
$factoryCallable callable
return object
    private function instantiateFromCallback($factoryCallable)
    {
        $instance = call_user_func_array($factoryCallable, $this->arguments);
        if (!is_object($instance)) {
            throw new FactoryDoesNotReturnObjectException(sprintf('The method %s::%s did not return an object, returned %s instead', $this->factoryMethod[0], $this->factoryMethod[1], gettype($instance)));
        }
        return $instance;
    }