Imbo\Resource\Stats::get PHP Метод

get() публичный Метод

Handle GET requests
public get ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The current event
    public function get(EventInterface $event)
    {
        $response = $event->getResponse();
        $response->setMaxAge(0)->setPrivate();
        $response->headers->addCacheControlDirective('no-store');
        $event->getManager()->trigger('db.stats.load');
    }

Usage Example

Пример #1
0
 /**
  * @covers Imbo\Resource\Stats::get
  */
 public function testTriggersTheCorrectEvent()
 {
     $responseHeaders = $this->getMock('Symfony\\Component\\HttpFoundation\\HeaderBag');
     $responseHeaders->expects($this->once())->method('addCacheControlDirective')->with('no-store');
     $this->response->headers = $responseHeaders;
     $this->response->expects($this->once())->method('setMaxAge')->with(0)->will($this->returnSelf());
     $this->response->expects($this->once())->method('setPrivate')->will($this->returnSelf());
     $this->eventManager->expects($this->once())->method('trigger')->with('db.stats.load');
     $this->resource->get($this->event);
 }