@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * @param string $host The api host |
19 | 19 | * @param Client $client The guzzle client to use |
20 | 20 | */ |
21 | - public function __construct($token, $server_id, $host = "api.digitalocean.com", Client $client = null){ |
|
21 | + public function __construct($token, $server_id, $host = "api.digitalocean.com", Client $client = null) { |
|
22 | 22 | |
23 | - if(!$client instanceof Client){ |
|
23 | + if (!$client instanceof Client) { |
|
24 | 24 | $client = new Client(); |
25 | 25 | } |
26 | 26 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * Executes a Boot command |
35 | 35 | * @return \Psr\Http\Message\ResponseInterface |
36 | 36 | */ |
37 | - public function boot(){ |
|
37 | + public function boot() { |
|
38 | 38 | return $this->exec("power_on"); |
39 | 39 | } |
40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * Executes a Reboot command |
43 | 43 | * @return \Psr\Http\Message\ResponseInterface |
44 | 44 | */ |
45 | - public function reboot(){ |
|
45 | + public function reboot() { |
|
46 | 46 | return $this->exec("reboot"); |
47 | 47 | } |
48 | 48 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Executes a Shutdown command |
51 | 51 | * @return \Psr\Http\Message\ResponseInterface |
52 | 52 | */ |
53 | - public function shutdown(){ |
|
53 | + public function shutdown() { |
|
54 | 54 | return $this->exec("power_off"); |
55 | 55 | } |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param string $action The DigitalOcean API action |
60 | 60 | * @return string |
61 | 61 | */ |
62 | - protected function buildRequestUrl($action){ |
|
62 | + protected function buildRequestUrl($action) { |
|
63 | 63 | return "https://{$this->host}/v2/droplets/{$this->server_id}/actions"; |
64 | 64 | } |
65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $action The DigitalOcean API action |
69 | 69 | * @return array |
70 | 70 | */ |
71 | - protected function buildRequestData($action){ |
|
71 | + protected function buildRequestData($action) { |
|
72 | 72 | return ["type"=>$action]; |
73 | 73 | } |
74 | 74 | |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | * @param string $action |
78 | 78 | * @return \Psr\Http\Message\ResponseInterface |
79 | 79 | */ |
80 | - protected function exec($action){ |
|
80 | + protected function exec($action) { |
|
81 | 81 | $url = $this->buildRequestUrl($action); |
82 | 82 | $data = $this->buildRequestData($action); |
83 | 83 | return $this->client->request('POST', $url, [ |
84 | - 'auth' => [$this->token,""], |
|
84 | + 'auth' => [$this->token, ""], |
|
85 | 85 | 'form_params' => $data, |
86 | 86 | ]); |
87 | 87 | } |