public function registerProducer($type, ProducerInterface $producer)
    {
        $registered_type = $this->requireRegisteredType($type);

        if (empty($this->producers[$registered_type])) {
            if ($producer instanceof ContainerAccessInterface && $this->hasContainer()) {
                $producer->setContainer($this->getContainer());
            }

            $this->producers[$registered_type] = $producer;
        } else {
            throw new LogicException("Producer for '$type' is already registered");
        }
    }
public function registerProducer($type, ProducerInterface $producer)
    {
        $registered_type = $this->requireRegisteredType($type);

        if (empty($this->producers[$registered_type])) {
            if ($producer instanceof ContainerAccessInterface && $this->hasContainer()) {
                $producer->setContainer($this->getContainer());
            }

            $this->producers[$registered_type] = $producer;
        } else {
            throw new LogicException("Producer for '$type' is already registered");
        }
    }
public function registerProducer ( $ type , ProducerInterface $ producer ) { $ registered_type = $ this -> requireRegisteredType ( $ type ) ; if ( empty ( $ this -> producers [ $ registered_type ] ) ) { if ( $ producer instanceof ContainerAccessInterface && $ this -> hasContainer ( ) ) { $ producer -> setContainer ( $ this -> getContainer ( ) ) ; } $ this -> producers [ $ registered_type ] = $ producer ; } else { throw new LogicException ( "Producer for '$type' is already registered" ) ; } }
Register producer instance for the given type.

@param string            $type
@param ProducerInterface $producer
Register producer instance for the given type .