public function testAllowsAddingVisitors() { $f = new VisitorFlyweight(); $j1 = new JsonRequestVisitor(); $j2 = new JsonResponseVisitor(); $f->addRequestVisitor('json', $j1); $f->addResponseVisitor('json', $j2); $this->assertSame($j1, $f->getRequestVisitor('json')); $this->assertSame($j2, $f->getResponseVisitor('json')); }
/** * Add a location visitor to the command * * @param string $location Location to associate with the visitor * @param ResponseVisitorInterface $visitor Visitor to attach * * @return self */ public function addVisitor($location, ResponseVisitorInterface $visitor) { $this->factory->addResponseVisitor($location, $visitor); return $this; }