final public function get(string $name)
    {
        $service_selected = null;
        foreach ($this->services as $one => $val) {
            if ($val['name'] === $name) {
                if (!in_array($val['content']->status, array("enabled", "disabled"))) {
                    throw new Server500(new \ArrayObject(array("explain" =>
                        "Undefined status [ ".$val['content']->status." ] for ".$val['name']." service",
                        "solution" => "Please set the status [disabled] or [enabled]")));
                }
                if ($val['content']->status == "disabled") {
                    throw new Server500(new \ArrayObject(array("explain" =>
                        "The service [ ".$val['name']." ] is currently disabled ",
                        "solution" => "Please set the status [enabled] to enable the service")));
                }
                $i = $val['content']->namespace;
                $container = FrameworkContainer::getInstance();
                return ($container->get($i));
            }
        }

        throw new Server500(new \ArrayObject(array("explain" =>
            "Undefined service : $name", "solution" => "Please register the [$name] service")));
    }
final public function get(string $name)
    {
        $service_selected = null;
        foreach ($this->services as $one => $val) {
            if ($val['name'] === $name) {
                if (!in_array($val['content']->status, array("enabled", "disabled"))) {
                    throw new Server500(new \ArrayObject(array("explain" =>
                        "Undefined status [ ".$val['content']->status." ] for ".$val['name']." service",
                        "solution" => "Please set the status [disabled] or [enabled]")));
                }
                if ($val['content']->status == "disabled") {
                    throw new Server500(new \ArrayObject(array("explain" =>
                        "The service [ ".$val['name']." ] is currently disabled ",
                        "solution" => "Please set the status [enabled] to enable the service")));
                }
                $i = $val['content']->namespace;
                $container = FrameworkContainer::getInstance();
                return ($container->get($i));
            }
        }

        throw new Server500(new \ArrayObject(array("explain" =>
            "Undefined service : $name", "solution" => "Please register the [$name] service")));
    }
final public function get ( string $ name ) { $ service_selected = null ; foreach ( $ this -> services as $ one => $ val ) { if ( $ val [ 'name' ] === $ name ) { if ( ! in_array ( $ val [ 'content' ] -> status , array ( "enabled" , "disabled" ) ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Undefined status [ " . $ val [ 'content' ] -> status . " ] for " . $ val [ 'name' ] . " service" , "solution" => "Please set the status [disabled] or [enabled]" ) ) ) ; } if ( $ val [ 'content' ] -> status == "disabled" ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "The service [ " . $ val [ 'name' ] . " ] is currently disabled " , "solution" => "Please set the status [enabled] to enable the service" ) ) ) ; } $ i = $ val [ 'content' ] -> namespace ; $ container = FrameworkContainer :: getInstance ( ) ; return ( $ container -> get ( $ i ) ) ; } } throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Undefined service : $name" , "solution" => "Please register the [$name] service" ) ) ) ; }
Get a service by name
@param string $name Service name
@return mixed The service object if exist
@throws Server500 Service does not exist
Get a service by name