PHP CS fixer
This commit is contained in:
parent
38b472aa83
commit
e411590cf6
5 changed files with 33 additions and 28 deletions
|
@ -99,7 +99,7 @@ abstract class OAuth
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers[] = "Content-length: ".strlen($payload);
|
$headers[] = 'Content-length: '.strlen($payload);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
// Send the request & save response to $response
|
// Send the request & save response to $response
|
||||||
|
|
|
@ -55,7 +55,6 @@ class Gitlab extends OAuth
|
||||||
return $accessToken['access_token'];
|
return $accessToken['access_token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +117,7 @@ class Gitlab extends OAuth
|
||||||
$user = $this->request('GET', 'https://gitlab.com/api/v4/user?access_token='.urlencode($accessToken));
|
$user = $this->request('GET', 'https://gitlab.com/api/v4/user?access_token='.urlencode($accessToken));
|
||||||
$this->user = json_decode($user, true);
|
$this->user = json_decode($user, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->user;
|
return $this->user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,7 @@ class Google extends OAuth
|
||||||
$user = $this->request('GET', 'https://www.googleapis.com/oauth2/v2/userinfo?access_token='.urlencode($accessToken));
|
$user = $this->request('GET', 'https://www.googleapis.com/oauth2/v2/userinfo?access_token='.urlencode($accessToken));
|
||||||
$this->user = json_decode($user, true);
|
$this->user = json_decode($user, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->user;
|
return $this->user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,7 @@ class Structure extends Validator
|
||||||
|
|
||||||
if ($ruleRequired && ('' === $value || null === $value)) {
|
if ($ruleRequired && ('' === $value || null === $value)) {
|
||||||
$this->message = 'Required property "'.$key.'" has no value';
|
$this->message = 'Required property "'.$key.'" has no value';
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +212,7 @@ class Structure extends Validator
|
||||||
if ($ruleArray) { // Array of values validation
|
if ($ruleArray) { // Array of values validation
|
||||||
if (!is_array($value)) {
|
if (!is_array($value)) {
|
||||||
$this->message = 'Property "'.$key.'" must be an array';
|
$this->message = 'Property "'.$key.'" must be an array';
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,12 +221,14 @@ class Structure extends Validator
|
||||||
foreach ($value as $node) {
|
foreach ($value as $node) {
|
||||||
if (!$validator->isValid($node)) { // Check if property is valid, if not required can also be empty
|
if (!$validator->isValid($node)) { // Check if property is valid, if not required can also be empty
|
||||||
$this->message = 'Property "'.$key.'" has invalid input. '.$validator->getDescription();
|
$this->message = 'Property "'.$key.'" has invalid input. '.$validator->getDescription();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // Single value validation
|
} else { // Single value validation
|
||||||
if ((!$validator->isValid($value)) && !('' === $value && !$ruleRequired)) { // Error when value is not valid, and is not optional and empty
|
if ((!$validator->isValid($value)) && !('' === $value && !$ruleRequired)) { // Error when value is not valid, and is not optional and empty
|
||||||
$this->message = 'Property "'.$key.'" has invalid input. '.$validator->getDescription();
|
$this->message = 'Property "'.$key.'" has invalid input. '.$validator->getDescription();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue