1 | <?php |
||
20 | abstract class BaseContext |
||
21 | { |
||
22 | /** @var DirectAdmin */ |
||
23 | private $connection; |
||
24 | |||
25 | /** |
||
26 | * Constructs the object. |
||
27 | * |
||
28 | * @param DirectAdmin $connection A prepared connection |
||
29 | */ |
||
30 | public function __construct(DirectAdmin $connection) |
||
34 | |||
35 | /** |
||
36 | * Returns the internal connection wrapper. |
||
37 | * |
||
38 | * @return DirectAdmin |
||
39 | */ |
||
40 | protected function getConnection() |
||
44 | |||
45 | /** |
||
46 | * Invokes the DirectAdmin API via HTTP GET. |
||
47 | * |
||
48 | * @param string $command DirectAdmin API command to invoke |
||
49 | * @param array $query Optional query parameters |
||
50 | * @return array The parsed and validated response |
||
51 | */ |
||
52 | public function invokeApiGet($command, $query = []) |
||
56 | |||
57 | /** |
||
58 | * Invokes the DirectAdmin API via HTTP POST. |
||
59 | * |
||
60 | * @param string $command DirectAdmin API command to invoke |
||
61 | * @param array $postParameters Optional form parameters |
||
62 | * @return array The parsed and validated response |
||
63 | */ |
||
64 | public function invokeApiPost($command, $postParameters = []) |
||
68 | } |
||
69 |