1 | <?php |
||
26 | class Nginx extends HttpProxyClient implements PurgeInterface, RefreshInterface |
||
27 | { |
||
28 | const HTTP_METHOD_PURGE = 'PURGE'; |
||
29 | const HTTP_METHOD_REFRESH = 'GET'; |
||
30 | const HTTP_HEADER_REFRESH = 'X-Refresh'; |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 2 | public function refresh($url, array $headers = []) |
|
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 4 | public function purge($url, array $headers = []) |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 6 | protected function configureOptions() |
|
58 | { |
||
59 | 6 | $resolver = parent::configureOptions(); |
|
60 | 6 | $resolver->setDefaults(['purge_location' => false]); |
|
61 | |||
62 | 6 | return $resolver; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * Create the correct URL to purge a resource. |
||
67 | * |
||
68 | * |
||
69 | * @param string $url URL |
||
70 | * |
||
71 | * @return string Rewritten URL |
||
72 | */ |
||
73 | 4 | private function buildPurgeUrl($url) |
|
90 | } |
||
91 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: