25 lines
496 B
PHP
25 lines
496 B
PHP
|
<?php
|
||
|
|
||
|
namespace NoccyLabs\Hotfix\Service;
|
||
|
|
||
|
class ServiceManager
|
||
|
{
|
||
|
private static $services = [];
|
||
|
|
||
|
public static function registerService(ServiceInterface $service)
|
||
|
{
|
||
|
self::$services[$service->getId()] = $service;
|
||
|
}
|
||
|
|
||
|
public static function getRegisteredServices()
|
||
|
{
|
||
|
return self::$services;
|
||
|
}
|
||
|
|
||
|
public static function getService($id)
|
||
|
{
|
||
|
if (!array_key_exists($id,self::$services)) return null;
|
||
|
return self::$services[$id];
|
||
|
}
|
||
|
|
||
|
}
|