Passed
Push — master ( 471990...8a0d16 )
by masoud
02:02
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
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
     use FNDEV\vShpare\Auth\SessionHandler;
4 4
     use FNDEV\vShpare\Client\GuzzleClient;
5 5
     use \GuzzleHttp\Client;
6
-    class VmwareApiClient{
6
+    class VmwareApiClient {
7 7
         public $host;
8 8
         public $credential;
9 9
         public $HttpClient;
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         public $authUrl;
13 13
         public $protocol;
14 14
         public $port;
15
-        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
+        public function __construct($host, array $credential, $port=443, $ssl=false, $protocol="https", $baseurl="/rest/vcenter", $authurl="/rest/com/vmware/cis/session", ?Client $client=null)
16 16
         {
17 17
             $this->host=$host;
18 18
             $this->port=$port;
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
             $this->baseUrl=$baseurl;
22 22
             $this->authUrl=$authurl;
23 23
             $this->protocol=$protocol;
24
-            $this->HttpClient=$client??new GuzzleClient($this);
24
+            $this->HttpClient=$client ?? new GuzzleClient($this);
25 25
         }
26
-        public function vm(){
26
+        public function vm() {
27 27
             return new Api\VM\VM($this->HttpClient);
28 28
         }
29
-        public function getHttpClient(){
29
+        public function getHttpClient() {
30 30
             return $this->HttpClient;
31 31
         }
32
-        public function setHttpClient(Client $client){
32
+        public function setHttpClient(Client $client) {
33 33
             $this->HttpClient=$client;
34 34
         }
35
-        public function getSessionId(){
35
+        public function getSessionId() {
36 36
             return SessionHandler::getSession($this);
37 37
         }
38
-        public function getBaseUrl(){
39
-            return $this->addScheme($this->host.":".$this->port."/".trim($this->baseUrl,"/")."/",$this->protocol);
38
+        public function getBaseUrl() {
39
+            return $this->addScheme($this->host.":".$this->port."/".trim($this->baseUrl, "/")."/", $this->protocol);
40 40
         }
41
-        public function getAuthUrl(){
42
-            return  $this->addScheme($this->host.":".$this->port."/".trim($this->authUrl,"/"),$this->protocol);
41
+        public function getAuthUrl() {
42
+            return  $this->addScheme($this->host.":".$this->port."/".trim($this->authUrl, "/"), $this->protocol);
43 43
         }
44
-        function addScheme($url, $scheme = 'http')
44
+        function addScheme($url, $scheme='http')
45 45
         {
46
-            return parse_url($url, PHP_URL_SCHEME) === null ?
47
-                $scheme."://" . $url : $url;
46
+            return parse_url($url, PHP_URL_SCHEME)===null ?
47
+                $scheme."://".$url : $url;
48 48
         }
49 49
     }
50 50
 
Please login to merge, or discard this patch.