@@ -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 | } |
@@ -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 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | private function prepareValidateType($key) |
66 | 66 | { |
67 | 67 | $key = str_replace('|', '', $key); |
68 | - $method = 'validate'.ucfirst($key); |
|
68 | + $method = 'validate' . ucfirst($key); |
|
69 | 69 | if (!method_exists(self::class, $method)) { |
70 | 70 | throw new EntityFieldsException( |
71 | 71 | "Internal error: the field \"$key\" doesn't match any of the entity predefined fields" |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | private function validateRequired($key, $value) |
87 | 87 | { |
88 | 88 | if (('add' === $this->action) || ('update' === $this->action)) { |
89 | - if (!isset($value) && (true === $this->fieldsParams[$key]['required_'.$this->action])) { |
|
90 | - throw new EntityFieldsException(ucfirst($this->action)." error: the required field \"$key\" is missing or empty"); |
|
89 | + if (!isset($value) && (true === $this->fieldsParams[$key]['required_' . $this->action])) { |
|
90 | + throw new EntityFieldsException(ucfirst($this->action) . " error: the required field \"$key\" is missing or empty"); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | private static function validateInt($key, $value) |
108 | 108 | { |
109 | - if (!is_int($value) || !preg_match('/^\d+$/', (string) $value)) { |
|
109 | + if (!is_int($value) || !preg_match('/^\d+$/', (string)$value)) { |
|
110 | 110 | throw new EntityFieldsException("The field \"$key\" must contain digits only"); |
111 | 111 | } |
112 | 112 |
@@ -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 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public static function isAlNum($value) |
18 | 18 | { |
19 | - if (!self::isCorrectType($value) || !ctype_alnum((string) $value)) { |
|
19 | + if (!self::isCorrectType($value) || !ctype_alnum((string)$value)) { |
|
20 | 20 | return false; |
21 | 21 | } |
22 | 22 |
@@ -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); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (!empty($params)) { |
47 | 47 | $query = '?'; |
48 | 48 | foreach ($params as $key => $param) { |
49 | - $query .= $key.'='.$param; |
|
49 | + $query .= $key . '=' . $param; |
|
50 | 50 | |
51 | 51 | if ($param !== end($params)) { |
52 | 52 | $query .= '&'; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - $result = isset($query) ? $host.$path.$query : $host.$path; |
|
57 | + $result = isset($query) ? $host . $path . $query : $host . $path; |
|
58 | 58 | |
59 | 59 | return $result; |
60 | 60 | } |
@@ -66,6 +66,6 @@ discard block |
||
66 | 66 | */ |
67 | 67 | private function makeUserHost($subdomain) |
68 | 68 | { |
69 | - return $this->settings->getScheme().'://'.$subdomain.'.'.$this->settings->getDomain(); |
|
69 | + return $this->settings->getScheme() . '://' . $subdomain . '.' . $this->settings->getDomain(); |
|
70 | 70 | } |
71 | 71 | } |
@@ -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 | /** |