Test Failed
Push — master ( 8a0d16...cb6ca3 )
by masoud
11:09
created
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.
src/Api/VM/Hardware/Hardware.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
 
12 12
 class Hardware extends InitClass
13 13
 {
14
-    public function cdrom(){
15
-        return new CDROM\CDROM($this->HttpClient,$this->vmSource);
14
+    public function cdrom() {
15
+        return new CDROM\CDROM($this->HttpClient, $this->vmSource);
16 16
     }
17
-    public function boot(){
18
-        return new Boot($this->HttpClient,$this->vmSource);
17
+    public function boot() {
18
+        return new Boot($this->HttpClient, $this->vmSource);
19 19
     }
20 20
 
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/VM/Hardware/Boot/Boot.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 class Boot extends InitClass
12 12
 {
13 13
     use MOID;
14
-    public function getHardwareBoot($moid=null){
14
+    public function getHardwareBoot($moid=null) {
15 15
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/hardware/boot"));
16 16
     }
17
-    public function updateHardwareBoot($moid=null){
17
+    public function updateHardwareBoot($moid=null) {
18 18
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/hardware"));
19 19
     }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/VM/Hardware/CDROM/CDROM.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
 class CDROM extends InitClass
12 12
 {
13 13
     use MOID;
14
-    public function getListCdRom($moid=null){
14
+    public function getListCdRom($moid=null) {
15 15
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/hardware/cdrom"));
16 16
     }
17
-    public function createCdRom($config,$moid=null){
18
-        return ApiResponse::BodyResponse($this->HttpClient->post("vm/{$this->getMoid($moid)}/hardware/cdrom",[
17
+    public function createCdRom($config, $moid=null) {
18
+        return ApiResponse::BodyResponse($this->HttpClient->post("vm/{$this->getMoid($moid)}/hardware/cdrom", [
19 19
             "json"=>$config
20 20
         ]));
21 21
     }
22
-    public function getCdRom($cdrom,$moid=null){
22
+    public function getCdRom($cdrom, $moid=null) {
23 23
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/hardware/cdrom/$cdrom"));
24 24
     }
25
-    public function deleteCdRom($cdrom,$moid=null){
25
+    public function deleteCdRom($cdrom, $moid=null) {
26 26
         return ApiResponse::BodyResponse($this->HttpClient->delete("vm/{$this->getMoid($moid)}/hardware/cdrom/$cdrom"));
27 27
     }
28
-    public function connectCdRom($cdrom,$moid=null){
28
+    public function connectCdRom($cdrom, $moid=null) {
29 29
         return ApiResponse::BodyResponse($this->HttpClient->post("vm/{$this->getMoid($moid)}/hardware/cdrom/$cdrom/connect"));
30 30
     }
31
-    public function disconnectCdRom($cdrom,$moid=null){
31
+    public function disconnectCdRom($cdrom, $moid=null) {
32 32
         return ApiResponse::BodyResponse($this->HttpClient->post("vm/{$this->getMoid($moid)}/hardware/cdrom/$cdrom/disconnect"));
33 33
     }
34
-    public function updateCdRom($cdrom,$config,$moid=null){
35
-        return ApiResponse::BodyResponse($this->HttpClient->patch("vm/{$this->getMoid($moid)}/hardware/cdrom/$cdrom",[
34
+    public function updateCdRom($cdrom, $config, $moid=null) {
35
+        return ApiResponse::BodyResponse($this->HttpClient->patch("vm/{$this->getMoid($moid)}/hardware/cdrom/$cdrom", [
36 36
             "json"=>$config
37 37
         ]));
38 38
     }
Please login to merge, or discard this patch.
src/Api/VM/Resources/Hardware/Hardware.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
 class Hardware extends InitClass
12 12
 {
13 13
     use MOID;
14
-    public function getHardware($moid=null){
14
+    public function getHardware($moid=null) {
15 15
         return ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->getMoid($moid)}/hardware"));
16 16
     }
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/VM/Resources/Resources.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
 class Resources extends InitClass
11 11
 {
12
-    public function hardware(){
13
-        return new Hardware($this->HttpClient,$this->vmSource);
12
+    public function hardware() {
13
+        return new Hardware($this->HttpClient, $this->vmSource);
14 14
     }
15 15
 
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/VM/VmSource.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     const POWERED_ON="POWERED_ON";
22 22
     const POWERED_OFF="POWERED_OFF";
23 23
     const SUSPENDED="SUSPENDED";
24
-    public function __construct(Client $HttpClient,$properties,$moid)
24
+    public function __construct(Client $HttpClient, $properties, $moid)
25 25
     {
26 26
         $this->HttpClient=$HttpClient;
27 27
         $this->properties=isset($properties->value) ? $properties->value : $properties;
@@ -31,35 +31,35 @@  discard block
 block discarded – undo
31 31
     {
32 32
         return $this->properties->{$name};
33 33
     }
34
-    public function reloadProperties(){
34
+    public function reloadProperties() {
35 35
         $this->properties=ApiResponse::BodyResponse($this->HttpClient->get("vm/{$this->moid}"))->value;
36 36
         return $this;
37 37
     }
38
-    public function power(){
39
-        return new Power($this->HttpClient,$this);
38
+    public function power() {
39
+        return new Power($this->HttpClient, $this);
40 40
     }
41
-    public function guestPower(){
42
-        return new GuestPower($this->HttpClient,$this);
41
+    public function guestPower() {
42
+        return new GuestPower($this->HttpClient, $this);
43 43
     }
44
-    public function tools(){
45
-        return new Tools($this->HttpClient,$this);
44
+    public function tools() {
45
+        return new Tools($this->HttpClient, $this);
46 46
     }
47
-    public function consoleTicket(){
48
-        return new ConsoleTickets($this->HttpClient,$this);
47
+    public function consoleTicket() {
48
+        return new ConsoleTickets($this->HttpClient, $this);
49 49
     }
50
-    public function hardware(){
51
-        return new Hardware($this->HttpClient,$this);
50
+    public function hardware() {
51
+        return new Hardware($this->HttpClient, $this);
52 52
     }
53
-    public function resources(){
54
-        return new Resources\Resources($this->HttpClient,$this);
53
+    public function resources() {
54
+        return new Resources\Resources($this->HttpClient, $this);
55 55
     }
56
-    public function isPoweredOn(){
56
+    public function isPoweredOn() {
57 57
         return $this->properties->power_state==self::POWERED_ON;
58 58
     }
59
-    public function isPoweredOff(){
59
+    public function isPoweredOff() {
60 60
         return $this->properties->power_state==self::POWERED_OFF;
61 61
     }
62
-    public function isSuspended(){
62
+    public function isSuspended() {
63 63
         return $this->properties->power_state==self::SUSPENDED;
64 64
     }
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.