Test Setup Failed
Branch master (33ce72)
by masoud
10:58
created
src/Api/VM/GuestPower/GuestPower.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
     /**
17 17
      * Returns information about the guest operating system power state.
18 18
      */
19
-    public function power($moid=null){
19
+    public function power($moid=null) {
20 20
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/guest/power"));
21 21
     }
22 22
     /**
23 23
      * Issues a request to the guest operating system asking it to perform a clean shutdown of all services. This request returns immediately and does not wait for the guest operating system to complete the operation.
24 24
      */
25
-    public function shutdown($moid=null){
26
-        return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/guest/power",[
25
+    public function shutdown($moid=null) {
26
+        return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/guest/power", [
27 27
             "query"=>[
28 28
                 "action"=>"shutdown"
29 29
             ]
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * Issues a request to the guest operating system asking it to perform a reboot. This request returns immediately and does not wait for the guest operating system to complete the operation
34 34
      */
35
-    public function reboot($moid=null){
36
-        return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/guest/power",[
35
+    public function reboot($moid=null) {
36
+        return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/guest/power", [
37 37
             "query"=>[
38 38
                 "action"=>"reboot"
39 39
             ]
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * Issues a request to the guest operating system asking it to perform a suspend operation.
44 44
      */
45
-    public function standby($moid=null){
46
-        return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/guest/power",[
45
+    public function standby($moid=null) {
46
+        return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/guest/power", [
47 47
             "query"=>[
48 48
                 "action"=>"standby"
49 49
             ]
Please login to merge, or discard this patch.
src/Api/VM/VM.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@
 block discarded – undo
16 16
     {
17 17
         $this->HttpClient=$client;
18 18
     }
19
-    public function power(){
19
+    public function power() {
20 20
         return new Power($this->HttpClient);
21 21
     }
22
-    public function guestPower(){
22
+    public function guestPower() {
23 23
         return new GuestPower($this->HttpClient);
24 24
     }
25
-    public function tools(){
25
+    public function tools() {
26 26
         return new Tools($this->HttpClient);
27 27
     }
28
-    public function consoleTicket(){
28
+    public function consoleTicket() {
29 29
         return new ConsoleTickets($this->HttpClient);
30 30
     }
31
-    public function hardWare(){
31
+    public function hardWare() {
32 32
         return new Hardware($this->HttpClient);
33 33
     }
34
-    public function all(array $query=null){
35
-        $response=$this->HttpClient->get("vm",[
34
+    public function all(array $query=null) {
35
+        $response=$this->HttpClient->get("vm", [
36 36
             "query"=>$query
37 37
         ]);
38
-        return new ManageVms(json_decode($response->getBody()),$this->HttpClient);
38
+        return new ManageVms(json_decode($response->getBody()), $this->HttpClient);
39 39
     }
40
-    public function byMoId($moid, array $query=[]){
41
-        $response=$this->HttpClient->get("vm/$moid",[
40
+    public function byMoId($moid, array $query=[]) {
41
+        $response=$this->HttpClient->get("vm/$moid", [
42 42
             "query"=>$query
43 43
         ]);
44
-        return new VmSource($this->HttpClient,json_decode($response->getBody()),$moid);
44
+        return new VmSource($this->HttpClient, json_decode($response->getBody()), $moid);
45 45
     }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/VM/Abstracts/InitClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 {
12 12
     public Client $HttpClient;
13 13
     public ?VmSource $vmSource;
14
-    public function __construct(Client $HttpClient,?VmSource $vmSource=null)
14
+    public function __construct(Client $HttpClient, ?VmSource $vmSource=null)
15 15
     {
16 16
         $this->HttpClient=$HttpClient;
17 17
         $this->vmSource=$vmSource;
Please login to merge, or discard this patch.
src/Api/VM/Power/Power.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@
 block discarded – undo
16 16
     /**
17 17
      * Returns the power state information of a virtual machine
18 18
      */
19
-    public function power($moid=null){
19
+    public function power($moid=null) {
20 20
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/power"));
21 21
     }
22 22
     /**
23 23
      * Returns the power state information of a virtual machine
24 24
      */
25
-    public function powerOff($moid=null){
25
+    public function powerOff($moid=null) {
26 26
         return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/power/stop"));
27 27
     }
28 28
     /**
29 29
      * Powers on a powered-off or suspended virtual machine
30 30
      */
31
-    public function powerOn($moid=null){
31
+    public function powerOn($moid=null) {
32 32
         return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/power/start"));
33 33
     }
34 34
     /**
35 35
      * Resets a powered-on virtual machine
36 36
      */
37
-    public function reset($moid=null){
37
+    public function reset($moid=null) {
38 38
         return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/power/reset"));
39 39
     }
40 40
     /**
41 41
      * Returns the power state information of a virtual machine
42 42
      */
43
-    public function suspend($moid=null){
43
+    public function suspend($moid=null) {
44 44
         return !ApiResponse::HasError($this->HttpClient->post("vm/{$this->getMoid($moid)}/power/suspend"));
45 45
     }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
src/VmwareApiClient.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
     namespace FNDEV\vShpare;
3 3
     use FNDEV\vShpare\Client\GuzzleClient;
4 4
     use \GuzzleHttp\Client;
5
-    class VmwareApiClient{
5
+    class VmwareApiClient {
6 6
         public $host;
7 7
         public $credential;
8 8
         public $HttpClient;
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
         public $authUrl;
12 12
         public $protocol;
13 13
         public $port;
14
-        public function __construct($host,array $credential,$port=443,$ssl=false,$protocol="https",$baseurl="/rest/vcenter",$authurl="/rest/com/vmware/cis/session",?Client $client=null)
14
+        public function __construct($host, array $credential, $port=443, $ssl=false, $protocol="https", $baseurl="/rest/vcenter", $authurl="/rest/com/vmware/cis/session", ?Client $client=null)
15 15
         {
16 16
             $this->host=$host;
17 17
             $this->port=$port;
@@ -20,30 +20,30 @@  discard block
 block discarded – undo
20 20
             $this->baseUrl=$baseurl;
21 21
             $this->authUrl=$authurl;
22 22
             $this->protocol=$protocol;
23
-            $this->HttpClient=$client??new GuzzleClient($this);
23
+            $this->HttpClient=$client ?? new GuzzleClient($this);
24 24
         }
25
-        public function vm(){
25
+        public function vm() {
26 26
             return new Api\VM\VM($this->HttpClient);
27 27
         }
28
-        public function getHttpClient(){
28
+        public function getHttpClient() {
29 29
             return $this->HttpClient;
30 30
         }
31
-        public function setHttpClient(Client $client){
31
+        public function setHttpClient(Client $client) {
32 32
             $this->HttpClient=$client;
33 33
         }
34
-        public function getSessionId(){
34
+        public function getSessionId() {
35 35
             return $this->HttpClient;
36 36
         }
37
-        public function getBaseUrl(){
38
-            return $this->addScheme($this->host.":".$this->port."/".trim($this->baseUrl,"/")."/",$this->protocol);
37
+        public function getBaseUrl() {
38
+            return $this->addScheme($this->host.":".$this->port."/".trim($this->baseUrl, "/")."/", $this->protocol);
39 39
         }
40
-        public function getAuthUrl(){
41
-            return  $this->addScheme($this->host.":".$this->port."/".trim($this->authUrl,"/"),$this->protocol);
40
+        public function getAuthUrl() {
41
+            return  $this->addScheme($this->host.":".$this->port."/".trim($this->authUrl, "/"), $this->protocol);
42 42
         }
43
-        function addScheme($url, $scheme = 'http')
43
+        function addScheme($url, $scheme='http')
44 44
         {
45
-            return parse_url($url, PHP_URL_SCHEME) === null ?
46
-                $scheme."://" . $url : $url;
45
+            return parse_url($url, PHP_URL_SCHEME)===null ?
46
+                $scheme."://".$url : $url;
47 47
         }
48 48
     }
49 49
 
Please login to merge, or discard this patch.