public static function createInstance($className, $projectPath)
    {
        Runtime::reset();
        self::$projectPath = $projectPath;
        $binder = new Binder();
        foreach (static::getBindingsForApp($className) as $bindingModule) {
            if (is_string($bindingModule)) {
                $bindingModule = new $bindingModule();
            }

            if ($bindingModule instanceof BindingModule) {
                $bindingModule->configure($binder, $projectPath);
            } elseif ($bindingModule instanceof \Closure) {
                $bindingModule($binder, $projectPath);
            } else {
                throw new \InvalidArgumentException(
                        'Given module class ' . get_class($bindingModule)
                        . ' is not an instance of stubbles\ioc\module\BindingModule'
                );
            }
        }

        return $binder->getInjector()->getInstance($className);
    }
public static function createInstance($className, $projectPath)
    {
        Runtime::reset();
        self::$projectPath = $projectPath;
        $binder = new Binder();
        foreach (static::getBindingsForApp($className) as $bindingModule) {
            if (is_string($bindingModule)) {
                $bindingModule = new $bindingModule();
            }

            if ($bindingModule instanceof BindingModule) {
                $bindingModule->configure($binder, $projectPath);
            } elseif ($bindingModule instanceof \Closure) {
                $bindingModule($binder, $projectPath);
            } else {
                throw new \InvalidArgumentException(
                        'Given module class ' . get_class($bindingModule)
                        . ' is not an instance of stubbles\ioc\module\BindingModule'
                );
            }
        }

        return $binder->getInjector()->getInstance($className);
    }
public static function createInstance ( $ className , $ projectPath ) { Runtime :: reset ( ) ; self :: $ projectPath = $ projectPath ; $ binder = new Binder ( ) ; foreach ( static :: getBindingsForApp ( $ className ) as $ bindingModule ) { if ( is_string ( $ bindingModule ) ) { $ bindingModule = new $ bindingModule ( ) ; } if ( $ bindingModule instanceof BindingModule ) { $ bindingModule -> configure ( $ binder , $ projectPath ) ; } elseif ( $ bindingModule instanceof \ Closure ) { $ bindingModule ( $ binder , $ projectPath ) ; } else { throw new \ InvalidArgumentException ( 'Given module class ' . get_class ( $ bindingModule ) . ' is not an instance of stubbles\ioc\module\BindingModule' ) ; } } return $ binder -> getInjector ( ) -> getInstance ( $ className ) ; }
creates an object via injection

If the class to create an instance of contains a static __bindings() method
this method will be used to configure the ioc bindings before using the ioc
container to create the instance.

@api
@param   string  $className    full qualified class name of class to create an instance of
@param   string  $projectPath  path to project
@return  \stubbles\App
creates an object via injection