Liip\RMT\Context::setService PHP Method

setService() public method

public setService ( $id, $classOrObject, $options = null )
    public function setService($id, $classOrObject, $options = null)
    {
        if (is_object($classOrObject)) {
            $this->services[$id] = $classOrObject;
        } elseif (is_string($classOrObject)) {
            $this->validateClass($classOrObject);
            $this->services[$id] = array($classOrObject, $options);
        } else {
            throw new \InvalidArgumentException('setService() only accept an object or a valid class name');
        }
    }

Usage Example

 public function setUp()
 {
     $this->application = new Application();
     $this->context = Context::create($this->application);
     $this->informationCollector = $this->getMock("\\Liip\\RMT\\Information\\InformationCollector");
     $this->context->setService('information-collector', $this->informationCollector);
 }
All Usage Examples Of Liip\RMT\Context::setService