| @@ -107,7 +107,7 @@ | ||
| 107 | 107 | * Узнаём путь до файла | 
| 108 | 108 | * Если передана ссылка, то скачиваем и кладём во временную директорию | 
| 109 | 109 | * | 
| 110 | - * @param $fileName | |
| 110 | + * @param string $fileName | |
| 111 | 111 | * @return string | 
| 112 | 112 | * @throws Exception | 
| 113 | 113 | */ | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | * @return string | 
| 112 | 112 | * @throws Exception | 
| 113 | 113 | */ | 
| 114 | -    protected function getFilePath($fileName){ | |
| 114 | +    protected function getFilePath($fileName) { | |
| 115 | 115 |          if (strpos($fileName, 'http://') !== false || strpos($fileName, 'https://') !== false) { | 
| 116 | 116 | $current = @file_get_contents($fileName); | 
| 117 | 117 |              if ($current) { | 
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | /** | 
| 134 | 134 | * @return string | 
| 135 | 135 | */ | 
| 136 | -    protected function getBaseUrl(){ | |
| 136 | +    protected function getBaseUrl() { | |
| 137 | 137 |          return "http://{$this->domain}/"; | 
| 138 | 138 | } | 
| 139 | 139 | |
| @@ -141,7 +141,7 @@ discard block | ||
| 141 | 141 | * @param string $action | 
| 142 | 142 | * @return string | 
| 143 | 143 | */ | 
| 144 | -    protected function getActionUrl($action){ | |
| 144 | +    protected function getActionUrl($action) { | |
| 145 | 145 |          return "{$this->getBaseUrl()}res.php?key={$this->apiKey}&action={$action}&id={$this->captchaId}"; | 
| 146 | 146 | } | 
| 147 | 147 | |
| @@ -149,14 +149,14 @@ discard block | ||
| 149 | 149 | * @param string $action | 
| 150 | 150 | * @return string | 
| 151 | 151 | */ | 
| 152 | -    protected function getResponse($action){ | |
| 152 | +    protected function getResponse($action) { | |
| 153 | 153 | return file_get_contents($this->getActionUrl($action)); | 
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | 156 | /** | 
| 157 | 157 | * @return string | 
| 158 | 158 | */ | 
| 159 | -    protected function getInUrl(){ | |
| 159 | +    protected function getInUrl() { | |
| 160 | 160 |          return "{$this->getBaseUrl()}in.php"; | 
| 161 | 161 | } | 
| 162 | 162 | |
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | * @param \Closure|null $callback | 
| 183 | 183 | * @return mixed | 
| 184 | 184 | */ | 
| 185 | -    protected function executionDelayed($delay = 0, $callback = null){ | |
| 185 | +    protected function executionDelayed($delay = 0, $callback = null) { | |
| 186 | 186 | $time = microtime(true); | 
| 187 | 187 | $timePassed = $time - $this->lastRunTime; | 
| 188 | 188 |          if ($timePassed < $delay) { | 
| @@ -197,7 +197,7 @@ discard block | ||
| 197 | 197 | * @return string | 
| 198 | 198 | * @throws Exception | 
| 199 | 199 | */ | 
| 200 | -    protected function getCurlResponse($postData){ | |
| 200 | +    protected function getCurlResponse($postData) { | |
| 201 | 201 | $ch = curl_init(); | 
| 202 | 202 | curl_setopt($ch, CURLOPT_URL, $this->getInUrl()); | 
| 203 | 203 |          if (version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0) { | 
| @@ -90,6 +90,9 @@ | ||
| 90 | 90 |          $this->getResponse('reportbad'); | 
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | + /** | |
| 94 | + * @param string $filePath | |
| 95 | + */ | |
| 93 | 96 |      protected function getPostData($filePath){ | 
| 94 | 97 | return [ | 
| 95 | 98 | 'method' => 'post', | 
| @@ -45,8 +45,8 @@ discard block | ||
| 45 | 45 | sleep($this->requestTimeout); | 
| 46 | 46 |                  } else { | 
| 47 | 47 |                      $ex = explode('|', $result); | 
| 48 | -                    if (trim($ex[0]) == 'OK') { | |
| 49 | - $this->result = trim($ex[1]); | |
| 48 | +                    if (trim($ex[ 0 ]) == 'OK') { | |
| 49 | + $this->result = trim($ex[ 1 ]); | |
| 50 | 50 | |
| 51 | 51 | return true; | 
| 52 | 52 | } | 
| @@ -90,7 +90,7 @@ discard block | ||
| 90 | 90 |          $this->getResponse('reportbad'); | 
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | -    protected function getPostData($filePath){ | |
| 93 | +    protected function getPostData($filePath) { | |
| 94 | 94 | return [ | 
| 95 | 95 | 'method' => 'post', | 
| 96 | 96 | 'key' => $this->apiKey, | 
| @@ -105,7 +105,7 @@ discard block | ||
| 105 | 105 | ]; | 
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | -    protected function decodeResponse($data, $type, $format = self::RESPONSE_TYPE_STRING){ | |
| 108 | +    protected function decodeResponse($data, $type, $format = self::RESPONSE_TYPE_STRING) { | |
| 109 | 109 | $result = [ | 
| 110 | 110 | 'type' => null, | 
| 111 | 111 | 'data' => null, | 
| @@ -112,8 +112,9 @@ | ||
| 112 | 112 | ]; | 
| 113 | 113 |          switch ($this->responseType) { | 
| 114 | 114 | case self::RESPONSE_TYPE_STRING: | 
| 115 | - if ($type) | |
| 116 | -                    $array = explode('|', $this->responseType); | |
| 115 | +                if ($type) { | |
| 116 | +                                    $array = explode('|', $this->responseType); | |
| 117 | + } | |
| 117 | 118 | |
| 118 | 119 | break; | 
| 119 | 120 | } | 
| @@ -104,7 +104,7 @@ | ||
| 104 | 104 | ]; | 
| 105 | 105 | |
| 106 | 106 | /** | 
| 107 | - * @param $name | |
| 107 | + * @param string $name | |
| 108 | 108 | * @return null|int | 
| 109 | 109 | */ | 
| 110 | 110 |      public function isThereSuch($name) { | 
| @@ -126,8 +126,8 @@ | ||
| 126 | 126 |          if (is_null($code)) { | 
| 127 | 127 | $message = $alias; | 
| 128 | 128 | $code = 0; | 
| 129 | -        }else { | |
| 130 | - $message = $this->errorsMessages[$code][$lang]; | |
| 129 | +        } else { | |
| 130 | + $message = $this->errorsMessages[ $code ][ $lang ]; | |
| 131 | 131 | } | 
| 132 | 132 |          if ($additionalText) { | 
| 133 | 133 | $message .= ": $additionalText"; | 
| @@ -126,7 +126,7 @@ | ||
| 126 | 126 |          if (is_null($code)) { | 
| 127 | 127 | $message = $alias; | 
| 128 | 128 | $code = 0; | 
| 129 | -        }else { | |
| 129 | +        } else { | |
| 130 | 130 | $message = $this->errorsMessages[$code][$lang]; | 
| 131 | 131 | } | 
| 132 | 132 |          if ($additionalText) { | 
| @@ -57,8 +57,8 @@ | ||
| 57 | 57 | sleep($this->requestTimeout); | 
| 58 | 58 |                  } else { | 
| 59 | 59 |                      $ex = explode('|', $result); | 
| 60 | -                    if (trim($ex[0]) == 'OK') { | |
| 61 | - $this->result = trim($ex[1]); | |
| 60 | +                    if (trim($ex[ 0 ]) == 'OK') { | |
| 61 | + $this->result = trim($ex[ 1 ]); | |
| 62 | 62 | |
| 63 | 63 | return true; | 
| 64 | 64 | } |