public function set(string $id, $service)
    {
        if ($this->frozen) {
            throw new FrozenContainerException(
                "The container is frozen and is not possible to define the new service \"{$id}\"."
            );
        }

        $this->definitions[$id] = $service;

        // clean alias and internal cache
        unset($this->services[$id]);
        unset($this->aliases[$id]);

        return $this;
    }
public function set(string $id, $service)
    {
        if ($this->frozen) {
            throw new FrozenContainerException(
                "The container is frozen and is not possible to define the new service \"{$id}\"."
            );
        }

        $this->definitions[$id] = $service;

        // clean alias and internal cache
        unset($this->services[$id]);
        unset($this->aliases[$id]);

        return $this;
    }
public function set ( string $ id , $ service ) { if ( $ this -> frozen ) { throw new FrozenContainerException ( "The container is frozen and is not possible to define the new service \"{$id}\"." ) ; } $ this -> definitions [ $ id ] = $ service ; // clean alias and internal cache unset ( $ this -> services [ $ id ] ) ; unset ( $ this -> aliases [ $ id ] ) ; return $ this ; }
Defines a new service.

@param string $id
@param mixed  $service
@return $this
Defines a new service .