1 | <?php |
||
8 | trait ManipulateHttpResponse |
||
9 | { |
||
10 | /** |
||
11 | * HTTP Request object. |
||
12 | * |
||
13 | * @var \Illuminate\Http\Request |
||
14 | */ |
||
15 | protected $requestHeaders; |
||
16 | |||
17 | /** |
||
18 | * Acknowledge the ESI support and send a specific |
||
19 | * HTTP header as a reply. |
||
20 | * |
||
21 | * @param \Illuminate\Http\Response $response |
||
22 | * @return void |
||
23 | */ |
||
24 | protected function acknowledgeEsiSupport(Response $response) |
||
32 | |||
33 | /** |
||
34 | * Add cacheable header so varnish can recognize |
||
35 | * the response as a cacheable content. |
||
36 | * |
||
37 | * @param \Illuminate\Http\Response $response |
||
38 | * @param int $cacheDuration |
||
39 | */ |
||
40 | protected function addCacheableHeader(Response $response, $cacheDuration) |
||
47 | |||
48 | /** |
||
49 | * Add an ETag header to the current response. |
||
50 | * |
||
51 | * @param \Illuminate\Http\Response $response |
||
52 | * @return void |
||
53 | */ |
||
54 | protected function addEtagHeader(Response $response) |
||
60 | |||
61 | /** |
||
62 | * Normalize the given cache duration and convert |
||
63 | * it to seconds. |
||
64 | * |
||
65 | * @param int $duration |
||
66 | * @return int |
||
|
|||
67 | */ |
||
68 | protected function getCacheDuration($duration) |
||
74 | |||
75 | /** |
||
76 | * Manipulate the current Http response. |
||
77 | * |
||
78 | * @param \Illuminate\Http\Response $response |
||
79 | * @param int $cacheDuration |
||
80 | * @return \Illuminate\Http\Response |
||
81 | */ |
||
82 | public function manipulate(Response $response, $cacheDuration) |
||
95 | |||
96 | /** |
||
97 | * Set the current Http request headers. |
||
98 | * |
||
99 | * @param \Symfony\Component\HttpFoundation\HeaderBag $headers |
||
100 | */ |
||
101 | public function setRequestHeaders(HeaderBag $headers) |
||
105 | |||
106 | /** |
||
107 | * Check if the current response shouldn't be cached. |
||
108 | * |
||
109 | * @param \Illuminate\Http\Response $response [description] |
||
110 | * @return boolean |
||
111 | */ |
||
112 | protected function shouldNotCache(Response $response) |
||
116 | |||
117 | /** |
||
118 | * Get configuration value for a specific key. |
||
119 | * |
||
120 | * @param string $key |
||
121 | * @return mixed |
||
122 | */ |
||
123 | abstract public function getConfig($key); |
||
124 | } |
||
125 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.