1 | <?php |
||
24 | abstract class HttpProxyClient implements ProxyClientInterface |
||
25 | { |
||
26 | /** |
||
27 | * Dispatcher for invalidation HTTP requests. |
||
28 | * |
||
29 | * @var HttpDispatcher |
||
30 | */ |
||
31 | private $httpDispatcher; |
||
32 | |||
33 | /** |
||
34 | * @var RequestFactory |
||
35 | */ |
||
36 | private $requestFactory; |
||
37 | |||
38 | /** |
||
39 | * The options configured in the constructor argument or default values. |
||
40 | * |
||
41 | * @var array The resolved options |
||
42 | */ |
||
43 | protected $options; |
||
44 | |||
45 | /** |
||
46 | * Constructor. |
||
47 | * |
||
48 | * The base class has no options. |
||
49 | * |
||
50 | * @param HttpDispatcher $httpDispatcher Helper to send HTTP requests to caching proxy |
||
51 | * @param array $options Options for this client |
||
52 | * @param RequestFactory|null $messageFactory Factory for PSR-7 messages. If none supplied, |
||
53 | * a default one is created |
||
54 | */ |
||
55 | 35 | public function __construct( |
|
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 22 | public function flush() |
|
72 | |||
73 | /** |
||
74 | * Get options resolver with default settings. |
||
75 | * |
||
76 | * @return OptionsResolver |
||
77 | */ |
||
78 | 35 | protected function configureOptions() |
|
82 | |||
83 | /** |
||
84 | * Create a request and queue it with the HTTP dispatcher. |
||
85 | * |
||
86 | * @param string $method |
||
87 | * @param string|UriInterface $url |
||
88 | * @param array $headers |
||
89 | */ |
||
90 | 30 | protected function queueRequest($method, $url, array $headers) |
|
96 | |||
97 | /** |
||
98 | * Make sure that the tags are valid. |
||
99 | * |
||
100 | * Reusable function for proxy clients. |
||
101 | * Escapes `,` and `\n` (newline) characters. |
||
102 | * |
||
103 | * @param array $tags The tags to escape |
||
104 | * |
||
105 | * @return array Sane tags |
||
106 | */ |
||
107 | protected function escapeTags(array $tags) |
||
115 | } |
||
116 |