private static function createInstance($classname, array $arguments = array())
    {
        $reflection_obj = new ReflectionClass($classname);
        if ($reflection_obj->getMethod('__construct')->isPublic()) {
            self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $arguments);
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                self::$_instances[ $classname ]->init();
            }
        } else {
            self::$_instances[ $classname ] = new $classname;
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                call_user_func_array(array(self::$_instances[ $classname ], 'init'), $arguments);
            }
        }
    }
private static function createInstance($classname, array $arguments = array())
    {
        $reflection_obj = new ReflectionClass($classname);
        if ($reflection_obj->getMethod('__construct')->isPublic()) {
            self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $arguments);
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                self::$_instances[ $classname ]->init();
            }
        } else {
            self::$_instances[ $classname ] = new $classname;
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                call_user_func_array(array(self::$_instances[ $classname ], 'init'), $arguments);
            }
        }
    }
private static function createInstance ( $ classname , array $ arguments = array ( ) ) { $ reflection_obj = new ReflectionClass ( $ classname ) ; if ( $ reflection_obj -> getMethod ( '__construct' ) -> isPublic ( ) ) { self :: $ _instances [ $ classname ] = call_user_func_array ( array ( $ reflection_obj , 'newInstance' ) , $ arguments ) ; if ( method_exists ( self :: $ _instances [ $ classname ] , 'init' ) && is_callable ( array ( self :: $ _instances [ $ classname ] , 'init' ) ) ) { self :: $ _instances [ $ classname ] -> init ( ) ; } } else { self :: $ _instances [ $ classname ] = new $ classname ; if ( method_exists ( self :: $ _instances [ $ classname ] , 'init' ) && is_callable ( array ( self :: $ _instances [ $ classname ] , 'init' ) ) ) { call_user_func_array ( array ( self :: $ _instances [ $ classname ] , 'init' ) , $ arguments ) ; } } }
Real object instances creation

@param   string  $classname  The classname to create object from
@param   array   $arguments  The arguments to pass to the `__construct` or `init` method
@return  void
Real object instances creation