Symfony\Component\HttpFoundation\Response::getAge PHP Method

getAge() public method

Returns the age of the response.
public getAge ( ) : integer
return integer The age of the response in seconds
    public function getAge()
    {
        if (null !== $age = $this->headers->get('Age')) {
            return (int) $age;
        }

        return max(time() - $this->getDate()->format('U'), 0);
    }

Usage Example

Example #1
0
 public function testUpdateResponse()
 {
     $this->response->setPublic()->shouldBeCalled();
     $this->response->setMaxAge($this->maxAge)->shouldBeCalled();
     $this->response->setSharedMaxAge($this->sharedMaxAge)->shouldBeCalled();
     $this->structure->getCacheLifeTime()->willReturn(10);
     $this->response->getAge()->willReturn(50);
     $this->handler->updateResponse($this->response->reveal(), $this->structure->reveal());
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::getAge