| 1 | <?php |
||
| 9 | class VarnishableService |
||
| 10 | { |
||
| 11 | use InvalidateVarnishCache; |
||
| 12 | use ManipulateHttpResponse; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Varnishable configurations. |
||
| 16 | * |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | protected $config; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Guzzle client object. |
||
| 23 | * |
||
| 24 | * @var \GuzzleHttp\Client |
||
| 25 | */ |
||
| 26 | protected $guzzle; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Class constructor. |
||
| 30 | * |
||
| 31 | * @param \GuzzleHttp\Client $guzzle |
||
| 32 | */ |
||
| 33 | public function __construct(Client $guzzle) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get configuration value for a specific key. |
||
| 41 | * |
||
| 42 | * @param string $key |
||
| 43 | * @return mixed |
||
| 44 | */ |
||
| 45 | public function getConfig($key) |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Get guzzle client object. |
||
| 52 | * |
||
| 53 | * @return \GuzzleHttp\Client |
||
| 54 | */ |
||
| 55 | public function getGuzzle() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Load the configurations. |
||
| 62 | * |
||
| 63 | * @return void |
||
| 64 | */ |
||
| 65 | public function loadConfig() |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Replace the guzzle http client object with |
||
| 72 | * a new one. |
||
| 73 | * |
||
| 74 | * @param \GuzzleHttp\Client $guzzle |
||
| 75 | */ |
||
| 76 | public function setGuzzle(Client $guzzle) |
||
| 80 | } |
||
| 81 |