src/ClassHelper.php
public static function create()
    {
        $args = func_get_args();

        // Class to create should be the calling class if not Object,
        // otherwise the first parameter
        $class = get_called_class();
        if ($class == 'Novusvetus\\ClassHelper\\ClassHelper') {
            $class = array_shift($args);
        }

        $class = self::getOverwriteClass($class);

        $r = new ReflectionClass($class);
        return $r->newInstanceArgs($args);
    }
public static function create()
    {
        $args = func_get_args();

        // Class to create should be the calling class if not Object,
        // otherwise the first parameter
        $class = get_called_class();
        if ($class == 'Novusvetus\\ClassHelper\\ClassHelper') {
            $class = array_shift($args);
        }

        $class = self::getOverwriteClass($class);

        $r = new ReflectionClass($class);
        return $r->newInstanceArgs($args);
    }
public static function create ( ) { $ args = func_get_args ( ) ; // Class to create should be the calling class if not Object, // otherwise the first parameter $ class = get_called_class ( ) ; if ( $ class == 'Novusvetus\\ClassHelper\\ClassHelper' ) { $ class = array_shift ( $ args ) ; } $ class = self :: getOverwriteClass ( $ class ) ; $ r = new ReflectionClass ( $ class ) ; return $ r -> newInstanceArgs ( $ args ) ; }
The factory method, allows you to create an instance of a class.

This can be called in two ways - calling via the class directly,
or calling on Object and passing the class name as the first parameter.

@param string $classOrArgument The first argument, or class name (if
called directly on Object).
@param mixed $argument,... arguments to pass to the constructor

@return static
The factory method allows you to create an instance of a class .