Passed
Push — master ( 44d4b0...6f1a5c )
by masoud
11:19
created
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("vcenter/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("vcenter/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("vcenter/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("vcenter/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("vcenter/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/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("vcenter/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/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("vcenter/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.
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("vcenter/vm",[
34
+    public function all(array $query=null) {
35
+        $response=$this->HttpClient->get("vcenter/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("vcenter/vm/$moid",[
40
+    public function byMoId($moid, array $query=[]) {
41
+        $response=$this->HttpClient->get("vcenter/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/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("vcenter/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("vcenter/vm/{$this->getMoid($moid)}/guest/power",[
25
+    public function shutdown($moid=null) {
26
+        return !ApiResponse::HasError($this->HttpClient->post("vcenter/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("vcenter/vm/{$this->getMoid($moid)}/guest/power",[
35
+    public function reboot($moid=null) {
36
+        return !ApiResponse::HasError($this->HttpClient->post("vcenter/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("vcenter/vm/{$this->getMoid($moid)}/guest/power",[
45
+    public function standby($moid=null) {
46
+        return !ApiResponse::HasError($this->HttpClient->post("vcenter/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/Tools/Tools.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     public function upgradeTools($body, $moid=null){
38 38
         return !ApiResponse::BodyResponse($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/tools",[
39 39
             "query"=>[
40
-              "action"=>"upgrade"
40
+                "action"=>"upgrade"
41 41
             ],
42 42
             RequestOptions::JSON=>$body
43 43
         ]));
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * Get the properties of VMware Tools.
20 20
      */
21
-    public function tools($moid=null){
21
+    public function tools($moid=null) {
22 22
         return ApiResponse::BodyResponse($this->HttpClient->get("vcenter/vm/{$this->getMoid($moid)}/tools"));
23 23
     }
24 24
 
25 25
     /**
26 26
      * Update the properties of VMware Tools.
27 27
      */
28
-    public function updateTools(array $body,$moid=null){
29
-        return !ApiResponse::HasError($this->HttpClient->patch("vcenter/vm/{$this->getMoid($moid)}/tools",[
28
+    public function updateTools(array $body, $moid=null) {
29
+        return !ApiResponse::HasError($this->HttpClient->patch("vcenter/vm/{$this->getMoid($moid)}/tools", [
30 30
             RequestOptions::JSON=>$body
31 31
         ]));
32 32
     }
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Begins the Tools upgrade process. To monitor the status of the Tools upgrade, clients should check the Tools status by calling Tools.get and examining Tools.Info.version-status and Tools.Info.run-state.
36 36
      */
37
-    public function upgradeTools($body, $moid=null){
38
-        return !ApiResponse::BodyResponse($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/tools",[
37
+    public function upgradeTools($body, $moid=null) {
38
+        return !ApiResponse::BodyResponse($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/tools", [
39 39
             "query"=>[
40 40
               "action"=>"upgrade"
41 41
             ],
Please login to merge, or discard this patch.
src/Api/VM/ConsoleTickets/ConsoleTickets.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 class ConsoleTickets extends InitClass
13 13
 {
14 14
     use MOID;
15
-    public function createConsoleTickets(array $body,$moid=null){
16
-        return ApiResponse::BodyResponse($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/console/tickets",[
15
+    public function createConsoleTickets(array $body, $moid=null) {
16
+        return ApiResponse::BodyResponse($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/console/tickets", [
17 17
             RequestOptions::JSON=>$body
18 18
         ]));
19 19
     }
Please login to merge, or discard this patch.
src/Api/VM/ManageVms.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@
 block discarded – undo
5 5
 use FNDEV\vShpare\Api\VM\Traits\IterableObject;
6 6
 use GuzzleHttp\Psr7\Response;
7 7
 
8
-class ManageVms implements \Iterator,\Countable {
9
-    use IterableObject,CountAbleObject;
8
+class ManageVms implements \Iterator, \Countable {
9
+    use IterableObject, CountAbleObject;
10 10
 
11
-    private array $items = [];
12
-    private int $position = 0;
13
-    public function __construct($vms,$HttpClient)
11
+    private array $items=[];
12
+    private int $position=0;
13
+    public function __construct($vms, $HttpClient)
14 14
     {
15
-        $this->parseObjects($vms,$HttpClient);
15
+        $this->parseObjects($vms, $HttpClient);
16 16
     }
17
-    public function parseObjects($vms,$HttpClient){
18
-        foreach ($vms->value as $VmProperties){
19
-            array_push($this->items,new VmSource($HttpClient,$VmProperties,$VmProperties->vm));
17
+    public function parseObjects($vms, $HttpClient) {
18
+        foreach ($vms->value as $VmProperties) {
19
+            array_push($this->items, new VmSource($HttpClient, $VmProperties, $VmProperties->vm));
20 20
         }
21 21
     }
22
-    public function first(){
23
-        return (count($this->items) >= 1) ? $this->items[0] : null ;
22
+    public function first() {
23
+        return (count($this->items)>=1) ? $this->items[0] : null;
24 24
     }
25 25
 
26 26
 
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("vcenter/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("vcenter/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.