@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class MissingServerKeyException extends CSFCloudException { |
| 8 | 8 | |
| 9 | - public function __construct() { |
|
| 9 | + public function __construct () { |
|
| 10 | 10 | parent::__construct("Missing server key"); |
| 11 | 11 | } |
| 12 | 12 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | private $client_id = null; |
| 11 | 11 | private $client_secret = null; |
| 12 | 12 | |
| 13 | - public function __construct(array $options) { |
|
| 13 | + public function __construct (array $options) { |
|
| 14 | 14 | $options = array_merge([ |
| 15 | 15 | "key" => null, |
| 16 | 16 | "client_id" => null, |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->client_secret = $options["client_secret"]; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function GetServerKey() : string { |
|
| 25 | + public function GetServerKey () : string { |
|
| 26 | 26 | if (!$this->server_key) { |
| 27 | 27 | throw new MissingServerKeyException(); |
| 28 | 28 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | protected $keymanager; |
| 10 | 10 | |
| 11 | - public function __construct(KeyManager $km) { |
|
| 11 | + public function __construct (KeyManager $km) { |
|
| 12 | 12 | $this->keymanager = $km; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | final class ContainerManagerTest extends TestCase { |
| 12 | 12 | |
| 13 | - public function testContainerListing() { |
|
| 13 | + public function testContainerListing () { |
|
| 14 | 14 | $keymgr = new KeyManager([ |
| 15 | 15 | "key" => "fQJO9bjlVXnUZv0sCaQA90QsJ0lPvs1o" |
| 16 | 16 | ]); |
@@ -11,35 +11,35 @@ |
||
| 11 | 11 | private $containerId; |
| 12 | 12 | private $statusCache; |
| 13 | 13 | |
| 14 | - public function __construct(KeyManager $km, string $id) { |
|
| 14 | + public function __construct (KeyManager $km, string $id) { |
|
| 15 | 15 | parent::__construct($km); |
| 16 | 16 | $this->containerId = $id; |
| 17 | 17 | $this->UpdateStatus(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - private function UpdateStatus() { |
|
| 20 | + private function UpdateStatus () { |
|
| 21 | 21 | $request = Request::get("https://api.csfcloud.com/container/" . urlencode($this->containerId) . "?key=" . urlencode($this->keymanager->GetServerKey()))->expectsText()->send(); |
| 22 | 22 | $this->statusCache = json_decode($request->body, true); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function GetConfiguration() : array { |
|
| 25 | + public function GetConfiguration () : array { |
|
| 26 | 26 | return $this->statusCache["configuration"]; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function SetConfiguration(array $cnf) { |
|
| 29 | + public function SetConfiguration (array $cnf) { |
|
| 30 | 30 | $this->statusCache["configuration"] = $cnf; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function UpdateChanges() { |
|
| 33 | + public function UpdateChanges () { |
|
| 34 | 34 | Request::put("https://api.csfcloud.com/container/" . urlencode($this->containerId) . "?key=" . urlencode($this->keymanager->GetServerKey())) |
| 35 | 35 | ->sendsJson()->body(json_encode($this->statusCache["configuration"]))->send(); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function GetContainerName() : string { |
|
| 38 | + public function GetContainerName () : string { |
|
| 39 | 39 | return $this->statusCache["configuration"]["name"]; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function SetContainerName(string $newname) { |
|
| 42 | + public function SetContainerName (string $newname) { |
|
| 43 | 43 | $this->statusCache["configuration"]["name"] = $newname; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -9,13 +9,13 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Manager extends Resource { |
| 11 | 11 | |
| 12 | - public function ListContainers() : array { |
|
| 12 | + public function ListContainers () : array { |
|
| 13 | 13 | $request = Request::get("https://api.csfcloud.com/container?key=" . urlencode($this->keymanager->GetServerKey()))->expectsText()->send(); |
| 14 | 14 | $cntlist = json_decode($request->body, true); |
| 15 | 15 | return $cntlist; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function GetContainer(string $id) : Container { |
|
| 18 | + public function GetContainer (string $id) : Container { |
|
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | /** |
| 14 | 14 | * @expectedException CSFCloud\Exceptions\MissingServerKeyException |
| 15 | 15 | */ |
| 16 | - public function testMissingKeyException() { |
|
| 16 | + public function testMissingKeyException () { |
|
| 17 | 17 | $mgr = new KeyManager([]); |
| 18 | 18 | $mgr->GetServerKey(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function testExistingKey() { |
|
| 21 | + public function testExistingKey () { |
|
| 22 | 22 | $mgr = new KeyManager([ |
| 23 | 23 | "key" => "mykey" |
| 24 | 24 | ]); |