public function bind(Service $service, bool $verify = true): void
    {
        // If there is no id
        if (null === $service->getId()) {
            // Throw a new exception
            throw new InvalidServiceIdException('Invalid service id provided.');
        }

        // If we should verify the dispatch
        if ($verify) {
            // Then verify it
            $this->app->dispatcher()->verifyDispatch($service);
        }

        self::$services[$service->getId()] = $service;
    }
public function bind(Service $service, bool $verify = true): void
    {
        // If there is no id
        if (null === $service->getId()) {
            // Throw a new exception
            throw new InvalidServiceIdException('Invalid service id provided.');
        }

        // If we should verify the dispatch
        if ($verify) {
            // Then verify it
            $this->app->dispatcher()->verifyDispatch($service);
        }

        self::$services[$service->getId()] = $service;
    }
public function bind ( Service $ service , bool $ verify = true ) : void { // If there is no id if ( null === $ service -> getId ( ) ) { // Throw a new exception throw new InvalidServiceIdException ( 'Invalid service id provided.' ) ; } // If we should verify the dispatch if ( $ verify ) { // Then verify it $ this -> app -> dispatcher ( ) -> verifyDispatch ( $ service ) ; } self :: $ services [ $ service -> getId ( ) ] = $ service ; }
Bind a service to the container.

@param Service $service The service model
@param bool    $verify  [optional] Whether to verify the service

@throws \Valkyrja\Container\Exceptions\InvalidServiceIdException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidClosureException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidDispatchCapabilityException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidFunctionException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidMethodException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidPropertyException

@return void
Bind a service to the container .