src/App.php
public function registerFactory($factory, $class)
    {
        $this[$factory] = $this->factory(function ($app) use ($class) {
            $obj = new $class;
            if ($obj instanceof FactoryInterface) {
                return $obj->create($app);
            } else {
                return $obj;
            }
        });
    }
public function registerFactory($factory, $class)
    {
        $this[$factory] = $this->factory(function ($app) use ($class) {
            $obj = new $class;
            if ($obj instanceof FactoryInterface) {
                return $obj->create($app);
            } else {
                return $obj;
            }
        });
    }
public function registerFactory ( $ factory , $ class ) { $ this [ $ factory ] = $ this -> factory ( function ( $ app ) use ( $ class ) { $ obj = new $ class ; if ( $ obj instanceof FactoryInterface ) { return $ obj -> create ( $ app ) ; } else { return $ obj ; } } ) ; }
Register a Factory to the DI container.
Factories return a new instance of a class each
time they are called

@param string $factory identifier
@param string $class   Class to create
Register a Factory to the DI container . Factories return a new instance of a class each time they are called