1 | <?php |
||
7 | class Varnish |
||
8 | { |
||
9 | /* |
||
10 | * Known exec types |
||
11 | */ |
||
12 | const EXEC_SOCKET = 'socket'; |
||
13 | const EXEC_COMMAND = 'command'; |
||
14 | |||
15 | /** |
||
16 | * @param string|array $host |
||
17 | * |
||
18 | * @return bool|null |
||
19 | * |
||
20 | * @throws \Exception |
||
21 | */ |
||
22 | public function flush($host = null): bool |
||
41 | |||
42 | /** |
||
43 | * @param array|string $host |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | protected function getHosts($host = null): array |
||
57 | |||
58 | /** |
||
59 | * @param string $expr |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function generateBanCommand($expr = ''): string |
||
69 | |||
70 | /** |
||
71 | * @param array $hosts |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function generateBanExpr(array $hosts): string |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getSecret() |
||
101 | |||
102 | /** |
||
103 | * @param string $command |
||
104 | * |
||
105 | * @return bool |
||
106 | * |
||
107 | * @throws \Exception When the command fails |
||
108 | */ |
||
109 | protected function executeCommand(string $command): bool |
||
116 | |||
117 | /** |
||
118 | * @param string $command |
||
119 | * |
||
120 | * @return bool |
||
121 | * |
||
122 | * @throws \Exception When connection to socket or command failed |
||
123 | */ |
||
124 | protected function executeSocketCommand(string $command): bool |
||
146 | } |
||
147 |