Completed
Push — master ( 60bd89...f71f50 )
by Владислав
04:12 queued 02:02
created
tests/TwoCaptchaTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         ]);
18 18
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
19 19
         $captcha->setCauseAnError(true);
20
-        $captcha->recognize(__DIR__.'/data/Captcha.jpg');
20
+        $captcha->recognize(__DIR__ . '/data/Captcha.jpg');
21 21
     }
22 22
 
23 23
     public function testRecognizeBalanceError2()
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
             \jumper423\decaptcha\services\TwoCaptcha::PARAM_SPEC_API_KEY => '200a1ed2b6ca001d8171c655658086ed',
27 27
         ]);
28 28
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
29
-        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
29
+        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
30 30
             $this->assertEquals('11111111111111', $captcha->getCode());
31 31
         } else {
32 32
             $this->assertEquals('Нулевой либо отрицательный баланс', $captcha->getError());
Please login to merge, or discard this patch.
tests/DeCaptchaAbstractTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function testGetBaseUrl()
20 20
     {
21 21
         $abstract = $this->newInstance();
22
-        $getBaseUrlCaller = function () {
22
+        $getBaseUrlCaller = function() {
23 23
             $this->host = 'domain';
24 24
 
25 25
             return $this->getBaseUrl();
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $this->assertEquals('http://domain/', $bound());
29 29
 
30 30
         $abstract = $this->newInstance();
31
-        $getBaseUrlCaller = function () {
31
+        $getBaseUrlCaller = function() {
32 32
             $this->host = 'domain';
33 33
             $this->scheme = 'https';
34 34
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
     public function testGetFilePath()
63 63
     {
64 64
         $abstract = $this->newInstance();
65
-        $getFilePathCaller = function ($val) {
65
+        $getFilePathCaller = function($val) {
66 66
             return $this->getFilePath($val);
67 67
         };
68 68
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
69
-        $this->assertEquals(__DIR__.'/data/Captcha.jpg', $bound(__DIR__.'/data/Captcha.jpg'));
69
+        $this->assertEquals(__DIR__ . '/data/Captcha.jpg', $bound(__DIR__ . '/data/Captcha.jpg'));
70 70
         $filePathUpload = $bound('https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg');
71
-        $file1 = file_get_contents(__DIR__.'/data/Captcha.jpg');
71
+        $file1 = file_get_contents(__DIR__ . '/data/Captcha.jpg');
72 72
         $file2 = file_get_contents($filePathUpload);
73 73
         $this->assertEquals($file1, $file2);
74 74
     }
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
     public function testGetFilePathErrorFileNotFound()
81 81
     {
82 82
         $abstract = $this->newInstance();
83
-        $getFilePathCaller = function ($val) {
83
+        $getFilePathCaller = function($val) {
84 84
             return $this->getFilePath($val);
85 85
         };
86 86
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
87
-        $bound(__DIR__.'/data/Captcha1.jpg');
87
+        $bound(__DIR__ . '/data/Captcha1.jpg');
88 88
     }
89 89
 
90 90
     /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function testGetFilePathErrorFileIsNotLoaded()
96 96
     {
97 97
         $abstract = $this->newInstance();
98
-        $getFilePathCaller = function ($val) {
98
+        $getFilePathCaller = function($val) {
99 99
             return $this->getFilePath($val);
100 100
         };
101 101
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function testExecutionDelayed()
118 118
     {
119 119
         $abstract = $this->newInstance();
120
-        $executionDelayedCaller = function ($second, $call = null) {
120
+        $executionDelayedCaller = function($second, $call = null) {
121 121
             return $this->executionDelayed($second, $call);
122 122
         };
123 123
         $bound = $executionDelayedCaller->bindTo($abstract, $abstract);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $this->assertTrue(abs($timePassed - 0.1) < 0.035);
129 129
 
130 130
         $start = microtime(true);
131
-        $bound(0.15, function () {
131
+        $bound(0.15, function() {
132 132
             sleep(0.2);
133 133
         });
134 134
         $bound(0.1);
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
         $this->assertTrue(abs($timePassed - 0.25) < 0.035);
137 137
 
138 138
         $start = microtime(true);
139
-        $bound(0.15, function () {
139
+        $bound(0.15, function() {
140 140
             sleep(0.2);
141 141
         });
142 142
         $bound(0.3);
143 143
         $timePassed = microtime(true) - $start;
144 144
         $this->assertTrue(abs($timePassed - 0.45) < 0.035);
145 145
 
146
-        $this->assertEquals(2, $bound(0, function () {
146
+        $this->assertEquals(2, $bound(0, function() {
147 147
             return 2;
148 148
         }));
149 149
         $this->assertEquals(null, $bound(0));
Please login to merge, or discard this patch.
tests/AnticaptchaTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
             \jumper423\decaptcha\services\Anticaptcha::PARAM_SPEC_API_KEY => '5464654645646',
12 12
         ]);
13 13
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
14
-        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
14
+        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
15 15
             $this->assertEquals('11111111111111', $captcha->getCode());
16 16
         } else {
17 17
             $this->assertEquals('Использован несуществующий key', $captcha->getError());
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_LANGUAGE => 'ru',
26 26
         ]);
27 27
         $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
28
-        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
28
+        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
29 29
             $this->assertEquals('11111111111111', $captcha->getCode());
30 30
         } else {
31 31
             $this->assertEquals('Нет в допустимых значиниях поля: languagePool = ru', $captcha->getError());
Please login to merge, or discard this patch.
src/core/DeCaptchaAbstract.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
         $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action];
103 103
         $decodeFormat = array_key_exists(static::DECODE_FORMAT, $decodeSetting) ?
104
-            $decodeSetting[static::DECODE_FORMAT] :
105
-            $this->decodeSettings[static::DECODE_FORMAT];
104
+            $decodeSetting[static::DECODE_FORMAT] : $this->decodeSettings[static::DECODE_FORMAT];
106 105
         $values = [];
107 106
         switch ($decodeFormat) {
108 107
             case static::RESPONSE_TYPE_STRING:
@@ -179,7 +178,7 @@  discard block
 block discarded – undo
179 178
      */
180 179
     protected function getActionUrl($action)
181 180
     {
182
-        return $this->getBaseUrl().$this->actions[$action][static::ACTION_URI];
181
+        return $this->getBaseUrl() . $this->actions[$action][static::ACTION_URI];
183 182
     }
184 183
 
185 184
     /**
@@ -229,7 +228,7 @@  discard block
 block discarded – undo
229 228
                         return base64_encode(file_get_contents($this->params[$param]));
230 229
                 }
231 230
 
232
-                return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@'.$this->getFilePath($this->params[$param]);
231
+                return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@' . $this->getFilePath($this->params[$param]);
233 232
             case static::PARAM_SPEC_API_KEY:
234 233
                 return is_callable($this->params[$param]) ? $this->params[$param]() : $this->params[$param];
235 234
             case static::PARAM_SPEC_CAPTCHA:
@@ -296,7 +295,7 @@  discard block
 block discarded – undo
296 295
                         break;
297 296
                 }
298 297
                 if (array_key_exists(self::PARAM_SLUG_ENUM, $settings) && !in_array($value, $settings[static::PARAM_SLUG_ENUM])) {
299
-                    throw new DeCaptchaErrors(DeCaptchaErrors::ERROR_PARAM_ENUM, (array_key_exists($field, $this->paramsNames) ? $this->paramsNames[$field] : $field).' = '.$value, $this->errorLang);
298
+                    throw new DeCaptchaErrors(DeCaptchaErrors::ERROR_PARAM_ENUM, (array_key_exists($field, $this->paramsNames) ? $this->paramsNames[$field] : $field) . ' = ' . $value, $this->errorLang);
300 299
                 }
301 300
                 $params[$this->paramsNames[$field]] = $value;
302 301
             }
@@ -360,7 +359,7 @@  discard block
 block discarded – undo
360 359
             foreach ($data as $key => $value) {
361 360
                 $uri[] = "$key=$value";
362 361
             }
363
-            $url .= '?'.implode('&', $uri);
362
+            $url .= '?' . implode('&', $uri);
364 363
         }
365 364
         curl_setopt($ch, CURLOPT_URL, $url);
366 365
         if (!$isJson && version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0 && defined('CURLOPT_SAFE_UPLOAD')) {
@@ -378,7 +377,7 @@  discard block
 block discarded – undo
378 377
             curl_setopt($ch, CURLOPT_HTTPHEADER, [
379 378
                 'Content-Type: application/json; charset=utf-8',
380 379
                 'Accept: application/json',
381
-                'Content-Length: '.strlen($data),
380
+                'Content-Length: ' . strlen($data),
382 381
             ]);
383 382
         }
384 383
         $result = curl_exec($ch);
Please login to merge, or discard this patch.
tests/wiki.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__.'/../src/core/DeCaptchaErrors.php';
4
-include_once __DIR__.'/../src/core/DeCaptchaInterface.php';
5
-include_once __DIR__.'/../src/core/DeCaptchaAbstract.php';
6
-include_once __DIR__.'/../src/core/DeCaptchaBase.php';
7
-include_once __DIR__.'/../src/services/RuCaptcha.php';
8
-include_once __DIR__.'/../src/services/Anticaptcha.php';
9
-include_once __DIR__.'/../src/services/AnticaptchaReCaptchaProxeless.php';
10
-include_once __DIR__.'/../src/services/AnticaptchaReCaptcha.php';
11
-include_once __DIR__.'/../src/core/DeCaptchaWiki.php';
3
+include_once __DIR__ . '/../src/core/DeCaptchaErrors.php';
4
+include_once __DIR__ . '/../src/core/DeCaptchaInterface.php';
5
+include_once __DIR__ . '/../src/core/DeCaptchaAbstract.php';
6
+include_once __DIR__ . '/../src/core/DeCaptchaBase.php';
7
+include_once __DIR__ . '/../src/services/RuCaptcha.php';
8
+include_once __DIR__ . '/../src/services/Anticaptcha.php';
9
+include_once __DIR__ . '/../src/services/AnticaptchaReCaptchaProxeless.php';
10
+include_once __DIR__ . '/../src/services/AnticaptchaReCaptcha.php';
11
+include_once __DIR__ . '/../src/core/DeCaptchaWiki.php';
12 12
 
13 13
 $rr = new \jumper423\decaptcha\core\DeCaptchaWiki();
14 14
 $rr->view();
Please login to merge, or discard this patch.
src/core/DeCaptchaWiki.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -31,160 +31,160 @@  discard block
 block discarded – undo
31 31
             'recognize_data'      => [
32 32
                 ($this->class)::ACTION_FIELD_FILE => 'http://site.com/captcha.jpg',
33 33
             ],
34
-            'field_main_name_'.($this->class)::ACTION_FIELD_KEY => [
34
+            'field_main_name_' . ($this->class)::ACTION_FIELD_KEY => [
35 35
                 'ru' => 'Ключ',
36 36
             ],
37
-            'field_main_desc_'.($this->class)::ACTION_FIELD_KEY => [
37
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_KEY => [
38 38
                 'ru' => 'Ключ от учетной записи',
39 39
             ],
40
-            'field_main_name_'.($this->class)::ACTION_FIELD_LANGUAGE => [
40
+            'field_main_name_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
41 41
                 'ru' => 'Язык',
42 42
             ],
43
-            'field_main_desc_'.($this->class)::ACTION_FIELD_LANGUAGE => [
43
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
44 44
                 'ru' => 'На каком языке текст на капче',
45 45
             ],
46
-            'field_main_name_'.($this->class)::ACTION_FIELD_FILE => [
46
+            'field_main_name_' . ($this->class)::ACTION_FIELD_FILE => [
47 47
                 'ru' => 'Картинка',
48 48
             ],
49
-            'field_main_desc_'.($this->class)::ACTION_FIELD_FILE => [
49
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_FILE => [
50 50
                 'ru' => 'Путь на файл с картинкой или ссылка на него',
51 51
             ],
52
-            'field_main_name_'.($this->class)::ACTION_FIELD_PHRASE => [
52
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PHRASE => [
53 53
                 'ru' => 'Несколько слов',
54 54
             ],
55
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PHRASE => [
55
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PHRASE => [
56 56
                 'ru' => 'Работник должен ввести текст с одним или несколькими пробелами',
57 57
             ],
58
-            'field_main_name_'.($this->class)::ACTION_FIELD_REGSENSE => [
58
+            'field_main_name_' . ($this->class)::ACTION_FIELD_REGSENSE => [
59 59
                 'ru' => 'Регистр',
60 60
             ],
61
-            'field_main_desc_'.($this->class)::ACTION_FIELD_REGSENSE => [
61
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_REGSENSE => [
62 62
                 'ru' => 'Работник должен ввсести ответ с учетом регистра',
63 63
             ],
64
-            'field_main_name_'.($this->class)::ACTION_FIELD_NUMERIC => [
64
+            'field_main_name_' . ($this->class)::ACTION_FIELD_NUMERIC => [
65 65
                 'ru' => 'Символы',
66 66
             ],
67
-            'field_main_desc_'.($this->class)::ACTION_FIELD_NUMERIC => [
67
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_NUMERIC => [
68 68
                 'ru' => 'Какие символы используется в капче',
69 69
             ],
70
-            'field_main_name_'.($this->class)::ACTION_FIELD_CALC => [
70
+            'field_main_name_' . ($this->class)::ACTION_FIELD_CALC => [
71 71
                 'ru' => 'Вычисление',
72 72
             ],
73
-            'field_main_desc_'.($this->class)::ACTION_FIELD_CALC => [
73
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_CALC => [
74 74
                 'ru' => 'На капче изображенно математичекая выражение и её необходимо решить',
75 75
             ],
76
-            'field_main_name_'.($this->class)::ACTION_FIELD_MIN_LEN => [
76
+            'field_main_name_' . ($this->class)::ACTION_FIELD_MIN_LEN => [
77 77
                 'ru' => 'Длина min',
78 78
             ],
79
-            'field_main_desc_'.($this->class)::ACTION_FIELD_MIN_LEN => [
79
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_MIN_LEN => [
80 80
                 'ru' => 'Минимальная длина капчи',
81 81
             ],
82
-            'field_main_name_'.($this->class)::ACTION_FIELD_MAX_LEN => [
82
+            'field_main_name_' . ($this->class)::ACTION_FIELD_MAX_LEN => [
83 83
                 'ru' => 'Длина max',
84 84
             ],
85
-            'field_main_desc_'.($this->class)::ACTION_FIELD_MAX_LEN => [
85
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_MAX_LEN => [
86 86
                 'ru' => 'Максимальная длина капчи',
87 87
             ],
88
-            'field_main_name_'.($this->class)::ACTION_FIELD_QUESTION => [
88
+            'field_main_name_' . ($this->class)::ACTION_FIELD_QUESTION => [
89 89
                 'ru' => 'Вопрос',
90 90
             ],
91
-            'field_main_desc_'.($this->class)::ACTION_FIELD_QUESTION => [
91
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_QUESTION => [
92 92
                 'ru' => 'На изображении задан вопрос, работник должен написать ответ',
93 93
             ],
94
-            'field_main_name_'.($this->class)::ACTION_FIELD_IS_RUSSIAN => [
94
+            'field_main_name_' . ($this->class)::ACTION_FIELD_IS_RUSSIAN => [
95 95
                 'ru' => 'Кириллица',
96 96
             ],
97
-            'field_main_desc_'.($this->class)::ACTION_FIELD_IS_RUSSIAN => [
97
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_IS_RUSSIAN => [
98 98
                 'ru' => 'На изображении присутствуют русские символы',
99 99
             ],
100
-            'field_main_name_'.($this->class)::ACTION_FIELD_LANGUAGE => [
100
+            'field_main_name_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
101 101
                 'ru' => 'Язык',
102 102
             ],
103
-            'field_main_desc_'.($this->class)::ACTION_FIELD_LANGUAGE => [
103
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
104 104
                 'ru' => 'Символы какого языка размещенны на капче',
105 105
             ],
106
-            'field_main_name_'.($this->class)::ACTION_FIELD_HEADER_ACAO => [
106
+            'field_main_name_' . ($this->class)::ACTION_FIELD_HEADER_ACAO => [
107 107
                 'ru' => 'Кросс-доменный',
108 108
             ],
109
-            'field_main_desc_'.($this->class)::ACTION_FIELD_HEADER_ACAO => [
109
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_HEADER_ACAO => [
110 110
                 'ru' => 'Необходимо для кросс-доменных AJAX запросов в браузерных приложениях.',
111 111
             ],
112
-            'field_main_name_'.($this->class)::ACTION_FIELD_INSTRUCTIONS => [
112
+            'field_main_name_' . ($this->class)::ACTION_FIELD_INSTRUCTIONS => [
113 113
                 'ru' => 'Инструкция',
114 114
             ],
115
-            'field_main_desc_'.($this->class)::ACTION_FIELD_INSTRUCTIONS => [
115
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_INSTRUCTIONS => [
116 116
                 'ru' => 'Текстовая капча или инструкция для прохождения капчи.',
117 117
             ],
118
-            'field_main_name_'.($this->class)::ACTION_FIELD_PINGBACK => [
118
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PINGBACK => [
119 119
                 'ru' => 'Ответ на',
120 120
             ],
121
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PINGBACK => [
121
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PINGBACK => [
122 122
                 'ru' => 'Указание для сервера, что после распознания изображения, нужно отправить ответ на указанный адрес.',
123 123
             ],
124
-            'field_main_name_'.($this->class)::ACTION_FIELD_LABEL => [
124
+            'field_main_name_' . ($this->class)::ACTION_FIELD_LABEL => [
125 125
                 'ru' => 'От куда',
126 126
             ],
127
-            'field_main_desc_'.($this->class)::ACTION_FIELD_LABEL => [
127
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_LABEL => [
128 128
                 'ru' => 'Пояснение от куда пришла капча ("vk", "google", "recaptcha", "yandex", "mailru", "yahoo" и т.д.).',
129 129
             ],
130
-            'field_main_name_'.($this->class)::ACTION_FIELD_PAGEURL => [
130
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PAGEURL => [
131 131
                 'ru' => 'Адрес',
132 132
             ],
133
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PAGEURL => [
133
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PAGEURL => [
134 134
                 'ru' => 'Адрес страницы на которой решается капча.',
135 135
             ],
136
-            'field_main_name_'.($this->class)::ACTION_FIELD_GOOGLEKEY => [
136
+            'field_main_name_' . ($this->class)::ACTION_FIELD_GOOGLEKEY => [
137 137
                 'ru' => 'Google key',
138 138
             ],
139
-            'field_main_desc_'.($this->class)::ACTION_FIELD_GOOGLEKEY => [
139
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_GOOGLEKEY => [
140 140
                 'ru' => 'Ключ-индентификатор рекапчи на целевой странице. <div class="g-recaptcha" data-sitekey="ВОТ_ЭТОТ"></div>',
141 141
             ],
142
-            'field_main_name_'.($this->class)::ACTION_FIELD_GOOGLETOKEN => [
142
+            'field_main_name_' . ($this->class)::ACTION_FIELD_GOOGLETOKEN => [
143 143
                 'ru' => 'Google token',
144 144
             ],
145
-            'field_main_desc_'.($this->class)::ACTION_FIELD_GOOGLETOKEN => [
145
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_GOOGLETOKEN => [
146 146
                 'ru' => 'Секретный токен для предыдущей версии рекапчи. В большинстве случаев сайты используют новую версию и этот токен не требуется. Секретный токен генерируется на сервере Google и вставляется на страницу в атрибуте data-stoken. Выглядит это примерно так: <script type="text/javascript" src="...." data-type="normal"  data-ray="..." async data-sitekey="..." data-stoken="ВОТ_ЭТОТ"></script> Токен действует пару минут после генерации, затем нужно снова зайти на страницу и получить его.',
147 147
             ],
148
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYTYPE => [
148
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYTYPE => [
149 149
                 'ru' => 'Тип прокси',
150 150
             ],
151
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYTYPE => [
151
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYTYPE => [
152 152
                 'ru' => 'Тип прокси (http, socks4, ...)',
153 153
             ],
154
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXY => [
154
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXY => [
155 155
                 'ru' => 'Адрес прокси',
156 156
             ],
157
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXY => [
157
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXY => [
158 158
                 'ru' => 'IP адрес прокси ipv4/ipv6.',
159 159
             ],
160
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYPORT => [
160
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYPORT => [
161 161
                 'ru' => 'Порт прокси',
162 162
             ],
163
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYPORT => [
163
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYPORT => [
164 164
                 'ru' => 'Порт прокси.',
165 165
             ],
166
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYLOGIN => [
166
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYLOGIN => [
167 167
                 'ru' => 'Логин прокси',
168 168
             ],
169
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYLOGIN => [
169
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYLOGIN => [
170 170
                 'ru' => 'Логин от прокси-сервера.',
171 171
             ],
172
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYPASS => [
172
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYPASS => [
173 173
                 'ru' => 'Пароль прокси',
174 174
             ],
175
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYPASS => [
175
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYPASS => [
176 176
                 'ru' => 'Пароль от прокси-сервера.',
177 177
             ],
178
-            'field_main_name_'.($this->class)::ACTION_FIELD_USERAGENT => [
178
+            'field_main_name_' . ($this->class)::ACTION_FIELD_USERAGENT => [
179 179
                 'ru' => 'User-Agent браузера',
180 180
             ],
181
-            'field_main_desc_'.($this->class)::ACTION_FIELD_USERAGENT => [
181
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_USERAGENT => [
182 182
                 'ru' => 'User-Agent браузера, используемый в эмуляции. Необходимо использовать подпись современного браузера, иначе Google будет возвращать ошибку, требуя обновить браузер.',
183 183
             ],
184
-            'field_main_name_'.($this->class)::ACTION_FIELD_COOKIES => [
184
+            'field_main_name_' . ($this->class)::ACTION_FIELD_COOKIES => [
185 185
                 'ru' => 'Куки',
186 186
             ],
187
-            'field_main_desc_'.($this->class)::ACTION_FIELD_COOKIES => [
187
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_COOKIES => [
188 188
                 'ru' => 'Дополнительные cookies которые мы должны использовать во время взаимодействия с целевой страницей.',
189 189
             ],
190 190
             'table_th_name' => [
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function getText($name, $separator = '; ')
279 279
     {
280
-        $getResult = function ($name, $texts) {
280
+        $getResult = function($name, $texts) {
281 281
             if (is_array($name)) {
282 282
                 $name = implode('_', $name);
283 283
             }
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
     {
313 313
         $rc = (new \ReflectionClass($this->class));
314 314
 
315
-        $str = "#####{$this->getText(['example', 'initialization'])}".PHP_EOL;
316
-        $str .= '```'.PHP_EOL;
317
-        $str .= "use {$rc->getName()};".PHP_EOL;
318
-        $str .= ''.PHP_EOL;
319
-        $str .= '$captcha = new '.$rc->getShortName().'(['.PHP_EOL;
315
+        $str = "#####{$this->getText(['example', 'initialization'])}" . PHP_EOL;
316
+        $str .= '```' . PHP_EOL;
317
+        $str .= "use {$rc->getName()};" . PHP_EOL;
318
+        $str .= '' . PHP_EOL;
319
+        $str .= '$captcha = new ' . $rc->getShortName() . '([' . PHP_EOL;
320 320
         foreach ($this->texts['constructor_data'] as $key => $val) {
321 321
             $str .= "    {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => ";
322 322
             if (is_string($val)) {
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
             } else {
325 325
                 $str .= "{$val}";
326 326
             }
327
-            $str .= ','.PHP_EOL;
327
+            $str .= ',' . PHP_EOL;
328 328
         }
329
-        $str .= ']);'.PHP_EOL;
330
-        $str .= '```'.PHP_EOL;
329
+        $str .= ']);' . PHP_EOL;
330
+        $str .= '```' . PHP_EOL;
331 331
 
332
-        $str .= "#####{$this->getText(['example', 'recognize'])}".PHP_EOL;
333
-        $str .= '```'.PHP_EOL;
332
+        $str .= "#####{$this->getText(['example', 'recognize'])}" . PHP_EOL;
333
+        $str .= '```' . PHP_EOL;
334 334
         $str .= 'if ($captcha->recognize(';
335 335
         if ($this->texts['recognize_file']) {
336 336
             $str .= "'{$this->getText(['recognize', 'data', 'file'])}'";
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             if ($this->texts['recognize_file']) {
340 340
                 $str .= ', ';
341 341
             }
342
-            $str .= '['.PHP_EOL;
342
+            $str .= '[' . PHP_EOL;
343 343
             foreach ($this->texts['recognize_data'] as $key => $val) {
344 344
                 $str .= "    {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => ";
345 345
                 if (is_string($val)) {
@@ -347,34 +347,34 @@  discard block
 block discarded – undo
347 347
                 } else {
348 348
                     $str .= "{$val}";
349 349
                 }
350
-                $str .= ','.PHP_EOL;
350
+                $str .= ',' . PHP_EOL;
351 351
             }
352 352
             $str .= ']';
353 353
         }
354
-        $str .= ')) {'.PHP_EOL;
355
-        $str .= '    $code = $captcha->getCode();'.PHP_EOL;
356
-        $str .= '} else {'.PHP_EOL;
357
-        $str .= '    $error = $captcha->getError());'.PHP_EOL;
358
-        $str .= '}'.PHP_EOL;
359
-        $str .= '```'.PHP_EOL;
354
+        $str .= ')) {' . PHP_EOL;
355
+        $str .= '    $code = $captcha->getCode();' . PHP_EOL;
356
+        $str .= '} else {' . PHP_EOL;
357
+        $str .= '    $error = $captcha->getError());' . PHP_EOL;
358
+        $str .= '}' . PHP_EOL;
359
+        $str .= '```' . PHP_EOL;
360 360
 
361
-        $str .= "#####{$this->getText(['example', 'nottrue'])}".PHP_EOL;
362
-        $str .= "{$this->getText(['example', 'nottrue', 'desc'])}".PHP_EOL;
363
-        $str .= '```'.PHP_EOL;
364
-        $str .= '$captcha->notTrue();'.PHP_EOL;
365
-        $str .= '```'.PHP_EOL;
361
+        $str .= "#####{$this->getText(['example', 'nottrue'])}" . PHP_EOL;
362
+        $str .= "{$this->getText(['example', 'nottrue', 'desc'])}" . PHP_EOL;
363
+        $str .= '```' . PHP_EOL;
364
+        $str .= '$captcha->notTrue();' . PHP_EOL;
365
+        $str .= '```' . PHP_EOL;
366 366
 
367
-        $str .= "#####{$this->getText(['example', 'balance'])}".PHP_EOL;
368
-        $str .= '```'.PHP_EOL;
369
-        $str .= '$balance = $captcha->getBalance();'.PHP_EOL;
370
-        $str .= '```'.PHP_EOL;
367
+        $str .= "#####{$this->getText(['example', 'balance'])}" . PHP_EOL;
368
+        $str .= '```' . PHP_EOL;
369
+        $str .= '$balance = $captcha->getBalance();' . PHP_EOL;
370
+        $str .= '```' . PHP_EOL;
371 371
 
372 372
         if ($this->getText(['example', 'error', 'lang', 'if'])) {
373
-            $str .= "#####{$this->getText(['example', 'error', 'lang'])}".PHP_EOL;
374
-            $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}".PHP_EOL;
375
-            $str .= '```'.PHP_EOL;
376
-            $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);'.PHP_EOL;
377
-            $str .= '```'.PHP_EOL;
373
+            $str .= "#####{$this->getText(['example', 'error', 'lang'])}" . PHP_EOL;
374
+            $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}" . PHP_EOL;
375
+            $str .= '```' . PHP_EOL;
376
+            $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);' . PHP_EOL;
377
+            $str .= '```' . PHP_EOL;
378 378
         }
379 379
 
380 380
         /*  constructor_data
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 
402 402
     private function viewFields()
403 403
     {
404
-        $str = " {$this->getText(['table', 'th', 'name'])} | {$this->getText(['table', 'th', 'code'])} | {$this->getText(['table', 'th', 'type'])} | {$this->getText(['table', 'th', 'req'])} | {$this->getText(['table', 'th', 'def'])} | {$this->getText(['table', 'th', 'enum'])} | {$this->getText(['table', 'th', 'desc'])} ".PHP_EOL;
405
-        $str .= ' --- | --- | --- | --- | --- | --- | --- '.PHP_EOL;
404
+        $str = " {$this->getText(['table', 'th', 'name'])} | {$this->getText(['table', 'th', 'code'])} | {$this->getText(['table', 'th', 'type'])} | {$this->getText(['table', 'th', 'req'])} | {$this->getText(['table', 'th', 'def'])} | {$this->getText(['table', 'th', 'enum'])} | {$this->getText(['table', 'th', 'desc'])} " . PHP_EOL;
405
+        $str .= ' --- | --- | --- | --- | --- | --- | --- ' . PHP_EOL;
406 406
         foreach ($this->class->actions[($this->class)::ACTION_RECOGNIZE][($this->class)::ACTION_FIELDS] as $param => $setting) {
407 407
             if (array_key_exists(($this->class)::ACTION_FIELDS, $setting) && is_array($setting[($this->class)::ACTION_FIELDS])) {
408 408
                 foreach ($setting[($this->class)::ACTION_FIELDS] as $param1 => $setting1) {
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
     {
426 426
         $str = " {$this->getText(['field', 'main', 'name', $param])} |";
427 427
         $str .= " {$this->getNameConst('ACTION_FIELD_', $param)} |";
428
-        $str .= ' '.substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[($this->class)::PARAM_SLUG_TYPE]), 17).' |';
429
-        $str .= ' '.(array_key_exists(($this->class)::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-').' |';
430
-        $str .= ' '.(array_key_exists(($this->class)::PARAM_SLUG_DEFAULT, $setting) ? $setting[($this->class)::PARAM_SLUG_DEFAULT] : '').' |';
428
+        $str .= ' ' . substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[($this->class)::PARAM_SLUG_TYPE]), 17) . ' |';
429
+        $str .= ' ' . (array_key_exists(($this->class)::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') . ' |';
430
+        $str .= ' ' . (array_key_exists(($this->class)::PARAM_SLUG_DEFAULT, $setting) ? $setting[($this->class)::PARAM_SLUG_DEFAULT] : '') . ' |';
431 431
         $str .= " {$this->getText(['field', 'slug', ($this->class)::PARAM_SLUG_ENUM, $param])} |";
432 432
         $str .= " {$this->getText(['field', 'main', 'desc', $param])} |";
433 433
         $str .= PHP_EOL;
@@ -449,20 +449,20 @@  discard block
 block discarded – undo
449 449
 
450 450
     public function view()
451 451
     {
452
-        $str = $this->getText(['service', 'name']).PHP_EOL;
453
-        $str .= '=============='.PHP_EOL;
454
-        $str .= "###{$this->getText(['slug', 'link'])}".PHP_EOL;
455
-        $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})".PHP_EOL.PHP_EOL;
456
-        $str .= "###{$this->getText(['slug', 'service', 'desc'])}".PHP_EOL;
457
-        $str .= "{$this->getText(['service', 'desc'])}".PHP_EOL.PHP_EOL;
458
-        $str .= "###{$this->getText(['slug', 'price'])}".PHP_EOL;
459
-        $str .= "{$this->getText(['recognize', 'price'])}".PHP_EOL.PHP_EOL;
460
-        $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}".PHP_EOL;
461
-        $str .= "{$this->getText(['recognize', 'desc'])}".PHP_EOL.PHP_EOL;
462
-        $str .= "###{$this->getText(['example'])}".PHP_EOL;
463
-        $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL;
464
-        $str .= "###{$this->getText(['slug', 'fields', 'desc'])}".PHP_EOL;
465
-        $str .= $this->viewFields().PHP_EOL;
452
+        $str = $this->getText(['service', 'name']) . PHP_EOL;
453
+        $str .= '==============' . PHP_EOL;
454
+        $str .= "###{$this->getText(['slug', 'link'])}" . PHP_EOL;
455
+        $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})" . PHP_EOL . PHP_EOL;
456
+        $str .= "###{$this->getText(['slug', 'service', 'desc'])}" . PHP_EOL;
457
+        $str .= "{$this->getText(['service', 'desc'])}" . PHP_EOL . PHP_EOL;
458
+        $str .= "###{$this->getText(['slug', 'price'])}" . PHP_EOL;
459
+        $str .= "{$this->getText(['recognize', 'price'])}" . PHP_EOL . PHP_EOL;
460
+        $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}" . PHP_EOL;
461
+        $str .= "{$this->getText(['recognize', 'desc'])}" . PHP_EOL . PHP_EOL;
462
+        $str .= "###{$this->getText(['example'])}" . PHP_EOL;
463
+        $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL;
464
+        $str .= "###{$this->getText(['slug', 'fields', 'desc'])}" . PHP_EOL;
465
+        $str .= $this->viewFields() . PHP_EOL;
466 466
 
467 467
         return $str;
468 468
     }
Please login to merge, or discard this patch.