protected function createClass(string $className)
    {
        if (!class_exists($className)) {
            throw new class("The class $className does not exists") extends Exception implements
                NotFoundExceptionInterface {
            };
        }

        $reflection = new ReflectionClass($className);

        if ($reflection->hasMethod('__construct')) {
            return $reflection->newInstanceArgs($this->arguments);
        }

        return $reflection->newInstance();
    }
protected function createClass(string $className)
    {
        if (!class_exists($className)) {
            throw new class("The class $className does not exists") extends Exception implements
                NotFoundExceptionInterface {
            };
        }

        $reflection = new ReflectionClass($className);

        if ($reflection->hasMethod('__construct')) {
            return $reflection->newInstanceArgs($this->arguments);
        }

        return $reflection->newInstance();
    }
protected function createClass ( string $ className ) { if ( ! class_exists ( $ className ) ) { throw new class ( "The class $className does not exists" ) extends Exception implements NotFoundExceptionInterface { } ; } $ reflection = new ReflectionClass ( $ className ) ; if ( $ reflection -> hasMethod ( '__construct' ) ) { return $ reflection -> newInstanceArgs ( $ this -> arguments ) ; } return $ reflection -> newInstance ( ) ; }
Returns the instance of a class.

@return object
Returns the instance of a class .