Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function replace(array $headers = array())
 {
     parent::replace($headers);
     if (!isset($this->headers['cache-control'])) {
         $this->set('cache-control', '');
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function replace(array $headers = [])
 {
     $this->headerNames = [];
     parent::replace($headers);
     if (!isset($this->headers['cache-control'])) {
         $this->set('Cache-Control', '');
     }
 }
 public function testCacheControlDirectiveOverrideWithReplace()
 {
     $bag = new HeaderBag(array('cache-control' => 'private, max-age=100'));
     $bag->replace(array('cache-control' => 'public, max-age=10'));
     $this->assertTrue($bag->hasCacheControlDirective('public'));
     $this->assertTrue($bag->getCacheControlDirective('public'));
     $this->assertTrue($bag->hasCacheControlDirective('max-age'));
     $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
 }