public function bind(string $name, $factory, bool $shared = true)
    {
        if (is_string($factory)) {
            return $this->bindClass($name, $factory, [], $shared);
        } elseif ($shared) {
            $this->bindFactoryShared($name, $factory);
        } else {
            $this->bindFactory($name, $factory);
        }
    }
public function bind(string $name, $factory, bool $shared = true)
    {
        if (is_string($factory)) {
            return $this->bindClass($name, $factory, [], $shared);
        } elseif ($shared) {
            $this->bindFactoryShared($name, $factory);
        } else {
            $this->bindFactory($name, $factory);
        }
    }
public function bind ( string $ name , $ factory , bool $ shared = true ) { if ( is_string ( $ factory ) ) { return $ this -> bindClass ( $ name , $ factory , [ ] , $ shared ) ; } elseif ( $ shared ) { $ this -> bindFactoryShared ( $ name , $ factory ) ; } else { $ this -> bindFactory ( $ name , $ factory ) ; } }
Binds a service factory to the container.

$container->bind('session', new SessionFactory);

$container->bind('config', function($c) {
return new Config($c->get('config.loader'));
}, false);

$container->bind('router', '\\Routing\\Router')
->addDependencyArgument('config');

@param string            $name The service name.
@param mixed             $factory The service factory instance, the closure or the classname as string
@param bool              $shared Should the service be shared inside the container.

@return Closure|ServiceFactoryInterface The given or generated service factory.
Binds a service factory to the container .