PHP Class Swap\Service\Registry

Author: Florian Voutzinos ([email protected])
Show file Open project: florianv/swap Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructor.
get ( string $name ) : string | null Gets a service.
has ( string $name ) : boolean Tells of the registry has the given service.
register ( string $name, string | callable $classOrCallable ) Registers a new service.

Private Methods

Method Description
registerServices ( ) Registers the core services.

Method Details

__construct() public method

Constructor.
public __construct ( )

get() public method

Gets a service.
public get ( string $name ) : string | null
$name string The service name
return string | null

has() public method

Tells of the registry has the given service.
public has ( string $name ) : boolean
$name string The service name
return boolean

register() public static method

Registers a new service.
public static register ( string $name, string | callable $classOrCallable )
$name string The service name
$classOrCallable string | callable The class name or a callable