src/Container/src/MutableContainer.php
private function register(string $id, bool $shared, Closure $registrationCallback)
    {
        // Check if correct service is provided.
        $this->validateId($id);
        $id = $this->normalize($id);

        // Clean up previous bindings, if any.
        unset($this->instances[$id], $this->shared[$id], $this->keys[$id]);

        // Register service with provided callback.
        $registrationCallback($id);

        // Mark service as shared when needed.
        $this->shared[$id] = $shared ?: null;

        // Save service key to make it recognizable by container.
        $this->keys[$id] = true;
    }
private function register(string $id, bool $shared, Closure $registrationCallback)
    {
        // Check if correct service is provided.
        $this->validateId($id);
        $id = $this->normalize($id);

        // Clean up previous bindings, if any.
        unset($this->instances[$id], $this->shared[$id], $this->keys[$id]);

        // Register service with provided callback.
        $registrationCallback($id);

        // Mark service as shared when needed.
        $this->shared[$id] = $shared ?: null;

        // Save service key to make it recognizable by container.
        $this->keys[$id] = true;
    }
private function register ( string $ id , bool $ shared , Closure $ registrationCallback ) { // Check if correct service is provided. $ this -> validateId ( $ id ) ; $ id = $ this -> normalize ( $ id ) ; // Clean up previous bindings, if any. unset ( $ this -> instances [ $ id ] , $ this -> shared [ $ id ] , $ this -> keys [ $ id ] ) ; // Register service with provided callback. $ registrationCallback ( $ id ) ; // Mark service as shared when needed. $ this -> shared [ $ id ] = $ shared ? : null ; // Save service key to make it recognizable by container. $ this -> keys [ $ id ] = true ; }
Registers binding.
After this method call binding can be resolved by container.

@param string $id
@param bool $shared
@param Closure $registrationCallback
@return void
Registers binding . After this method call binding can be resolved by container .