public function registerService($className)
    {
        if (! class_exists($className)) {
            throw new Exception(sprintf(Exception::SERVICE_CLASS_NOT_EXISTS, $className));
        }

        $service = new $className($this);

        if (!$service instanceof Service) {
            throw new Exception(sprintf(Exception::NOT_A_SERVICE, $className));
        }
        if ($this->services->offsetExists($service->name())) {
            throw new Exception(sprintf(Exception::SERVICE_ALREADY_EXISTS, $service->name()));
        }

        $this->services->offsetSet($service->name(), $service);
    }
public function registerService($className)
    {
        if (! class_exists($className)) {
            throw new Exception(sprintf(Exception::SERVICE_CLASS_NOT_EXISTS, $className));
        }

        $service = new $className($this);

        if (!$service instanceof Service) {
            throw new Exception(sprintf(Exception::NOT_A_SERVICE, $className));
        }
        if ($this->services->offsetExists($service->name())) {
            throw new Exception(sprintf(Exception::SERVICE_ALREADY_EXISTS, $service->name()));
        }

        $this->services->offsetSet($service->name(), $service);
    }
public function registerService ( $ className ) { if ( ! class_exists ( $ className ) ) { throw new Exception ( sprintf ( Exception :: SERVICE_CLASS_NOT_EXISTS , $ className ) ) ; } $ service = new $ className ( $ this ) ; if ( ! $ service instanceof Service ) { throw new Exception ( sprintf ( Exception :: NOT_A_SERVICE , $ className ) ) ; } if ( $ this -> services -> offsetExists ( $ service -> name ( ) ) ) { throw new Exception ( sprintf ( Exception :: SERVICE_ALREADY_EXISTS , $ service -> name ( ) ) ) ; } $ this -> services -> offsetSet ( $ service -> name ( ) , $ service ) ; }
Process the registration of one service.

@param string $className The class name of the service

@throws \Subbly\Api\Exception If class name does not exists
@throws \Subbly\Api\Exception If the class does not implement \Subbly\Api\Service\Service
@throws \Subbly\Api\Exception If service name is already register
Process the registration of one service .