@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | parent::__construct($message); |
| 22 | 22 | |
| 23 | - $this->message .= '. Server response: '.$response; |
|
| 24 | - $this->message .= '. Url: '.$url; |
|
| 23 | + $this->message .= '. Server response: ' . $response; |
|
| 24 | + $this->message .= '. Url: ' . $url; |
|
| 25 | 25 | } |
| 26 | 26 | } |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | { |
| 20 | 20 | parent::__construct($message); |
| 21 | 21 | |
| 22 | - $this->message .= '. Server response: '.$response; |
|
| 22 | + $this->message .= '. Server response: ' . $response; |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | $result = $this->dataSender->send($this->urlBuilder->buildMethodUrl('auth'), $this->credentials->getCredentials()); |
| 132 | 132 | |
| 133 | 133 | if (!empty($result) && (!file_exists($this->settings->getCookiePath()))) { |
| 134 | - $message = 'An error occurred while creating the cookie file '.$this->settings->getCookiePath(); |
|
| 134 | + $message = 'An error occurred while creating the cookie file ' . $this->settings->getCookiePath(); |
|
| 135 | 135 | throw new RuntimeException($message); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->curl->close(); |
| 65 | 65 | $this->validateCode($code, $url, $response); |
| 66 | 66 | |
| 67 | - return (string) $response; |
|
| 67 | + return (string)$response; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | 504 => '504 Gateway Timeout', |
| 88 | 88 | ]; |
| 89 | 89 | |
| 90 | - return isset($errors[$code]) ? $errors[$code] : $code.' Unknown error'; |
|
| 90 | + return isset($errors[$code]) ? $errors[$code] : $code . ' Unknown error'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | switch ($code) { |
| 106 | 106 | case 401: |
| 107 | 107 | case 403: |
| 108 | - throw new FailedAuthException('Auth failed! '.self::getErrorByHttpCode($code), $response); |
|
| 108 | + throw new FailedAuthException('Auth failed! ' . self::getErrorByHttpCode($code), $response); |
|
| 109 | 109 | break; |
| 110 | 110 | case 200 !== $code && 204 !== $code: |
| 111 | 111 | throw new ErrorCodeException(self::getErrorByHttpCode($code), $response, $url); |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | private function prepareClassName($name) |
| 47 | 47 | { |
| 48 | - return SettingsStorage::NAMESPACE_PREFIX.'\Model\Amo\\'.rtrim(ucfirst($name), 's'); |
|
| 48 | + return SettingsStorage::NAMESPACE_PREFIX . '\Model\Amo\\' . rtrim(ucfirst($name), 's'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -218,13 +218,13 @@ |
||
| 218 | 218 | { |
| 219 | 219 | switch ($this->fieldsParams[$key]['type']) { |
| 220 | 220 | case 'int': |
| 221 | - $value = (int) $value; |
|
| 221 | + $value = (int)$value; |
|
| 222 | 222 | break; |
| 223 | 223 | case 'string': |
| 224 | - $value = (string) $value; |
|
| 224 | + $value = (string)$value; |
|
| 225 | 225 | break; |
| 226 | 226 | case 'bool': |
| 227 | - $value = (bool) $value; |
|
| 227 | + $value = (bool)$value; |
|
| 228 | 228 | break; |
| 229 | 229 | } |
| 230 | 230 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class SettingsStorage |
| 14 | 14 | { |
| 15 | - const LIB_PATH = __DIR__.'/..'; |
|
| 15 | + const LIB_PATH = __DIR__ . '/..'; |
|
| 16 | 16 | |
| 17 | 17 | const NAMESPACE_PREFIX = '\ddlzz\AmoAPI'; |
| 18 | 18 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | private $userAgent = 'amoAPI PHP Client'; |
| 54 | 54 | |
| 55 | 55 | /** @var string */ |
| 56 | - private $cookiePath = self::LIB_PATH.'/var/cookie.txt'; |
|
| 56 | + private $cookiePath = self::LIB_PATH . '/var/cookie.txt'; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * SettingsStorage constructor. |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public static function searchAndReplace($search, $replace, $haystack) |
| 22 | 22 | { |
| 23 | - $callback = function (&$value, $key, array $params) { |
|
| 23 | + $callback = function(&$value, $key, array $params) { |
|
| 24 | 24 | if ($params['search'] === $value) { |
| 25 | 25 | $value = $params['replace']; |
| 26 | 26 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | private function prepareValidateType($key) |
| 64 | 64 | { |
| 65 | 65 | $key = str_replace('|', '', $key); |
| 66 | - $method = 'validate'.ucfirst($key); |
|
| 66 | + $method = 'validate' . ucfirst($key); |
|
| 67 | 67 | if (!method_exists(self::class, $method)) { |
| 68 | 68 | throw new EntityFieldsException( |
| 69 | 69 | sprintf('Internal error: the field "%s" doesn\'t match any of the entity predefined fields', $key) |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | private function validateRequired($key, $value) |
| 85 | 85 | { |
| 86 | 86 | if (('add' === $this->action) || ('update' === $this->action)) { |
| 87 | - if (null === $value && (true === $this->fieldsParams[$key]['required_'.$this->action])) { |
|
| 87 | + if (null === $value && (true === $this->fieldsParams[$key]['required_' . $this->action])) { |
|
| 88 | 88 | throw new EntityFieldsException(sprintf('%s error: the required field "%s" is missing or empty', ucfirst($this->action), $key)); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | private static function validateInt($key, $value) |
| 106 | 106 | { |
| 107 | - if (!is_int($value) || !preg_match('/^\d+$/', (string) $value)) { |
|
| 107 | + if (!is_int($value) || !preg_match('/^\d+$/', (string)$value)) { |
|
| 108 | 108 | throw new EntityFieldsException(sprintf('The field "%s" must contain digits only', $key)); |
| 109 | 109 | } |
| 110 | 110 | |