Liip\RMT\Information\InformationCollector::registerRequest PHP Method

registerRequest() public method

public registerRequest ( $request )
    public function registerRequest($request)
    {
        $name = $request->getName();
        if (in_array($name, static::$standardRequests)) {
            throw new \Exception("Request [{$name}] is reserved as a standard request name, choose an other name please");
        }
        if ($this->hasRequest($name)) {
            throw new \Exception("Request [{$name}] already registered");
        }
        $this->requests[$name] = $request;
    }

Usage Example

 public function testSetAndGetValueFor()
 {
     $ic = new InformationCollector();
     $ic->registerRequest(new InformationRequest('foo'));
     $ic->setValueFor('foo', 'bar');
     $this->assertEquals('bar', $ic->getValueFor('foo'));
 }
All Usage Examples Of Liip\RMT\Information\InformationCollector::registerRequest