src/Injector.php
public function factory(string $className, callable $factory):void
    {
        $this->config->registerClassFactory($className, $factory);
    }
public function factory(string $className, callable $factory):void
    {
        $this->config->registerClassFactory($className, $factory);
    }
public function factory ( string $ className , callable $ factory ) : void { $ this -> config -> registerClassFactory ( $ className , $ factory ) ; }
Intercept a class instantiation.

$inj->factory(Foo::class, function(FooFactory $factory):Foo {
return $factory->create();
})

@param string $className
@param callable $factory
Intercept a class instantiation .