src/Application/Service/ServiceContainer.php
public function set(string $name, callable $callback): void
    {
        $this->services[$name] = function ($c) use ($callback) {
            static $object;

            if ($object === null) {
                $object = $callback($c);
            }

            return $object;
        };
    }
public function set(string $name, callable $callback): void
    {
        $this->services[$name] = function ($c) use ($callback) {
            static $object;

            if ($object === null) {
                $object = $callback($c);
            }

            return $object;
        };
    }
public function set ( string $ name , callable $ callback ) : void { $ this -> services [ $ name ] = function ( $ c ) use ( $ callback ) { static $ object ; if ( $ object === null ) { $ object = $ callback ( $ c ) ; } return $ object ; } ; }
Defines a shared service

@param string   $name     The service name
@param callable $callback The service factory callback

@return void
Defines a shared service