@@ -36,8 +36,9 @@ |
||
| 36 | 36 | } |
| 37 | 37 | public static function validateCredentials(VmwareApiClient $client) |
| 38 | 38 | { |
| 39 | - if((array_key_exists("username",$client->credential) && array_key_exists("password",$client->credential)) or array_key_exists("Vmware-Api-Session-Id",$client->credential)) |
|
| 40 | - return true; |
|
| 39 | + if((array_key_exists("username",$client->credential) && array_key_exists("password",$client->credential)) or array_key_exists("Vmware-Api-Session-Id",$client->credential)) { |
|
| 40 | + return true; |
|
| 41 | + } |
|
| 41 | 42 | throw new CredentialException("required parameter you should send session-id or username-password for auth api "); |
| 42 | 43 | } |
| 43 | 44 | public static function convertCredentials($credentials){ |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | public function upgradeTools($body, $moid=null){ |
| 38 | 38 | return !ApiResponse::BodyResponse($this->HttpClient->post("vm/{$this->getMoid($moid)}/tools",[ |
| 39 | 39 | "query"=>[ |
| 40 | - "action"=>"upgrade" |
|
| 40 | + "action"=>"upgrade" |
|
| 41 | 41 | ], |
| 42 | 42 | RequestOptions::JSON=>$body |
| 43 | 43 | ])); |
@@ -7,10 +7,12 @@ |
||
| 7 | 7 | trait MOID |
| 8 | 8 | { |
| 9 | 9 | public function getMoid($moid=null){ |
| 10 | - if($moid) |
|
| 11 | - return $moid; |
|
| 12 | - if($this->vmSource && isset($this->vmSource->moid)) |
|
| 13 | - return $this->vmSource->moid; |
|
| 10 | + if($moid) { |
|
| 11 | + return $moid; |
|
| 12 | + } |
|
| 13 | + if($this->vmSource && isset($this->vmSource->moid)) { |
|
| 14 | + return $this->vmSource->moid; |
|
| 15 | + } |
|
| 14 | 16 | throw new \InvalidArgumentException("provide moid or pass vmSource object"); |
| 15 | 17 | } |
| 16 | 18 | } |
| 17 | 19 | \ No newline at end of file |