Completed
Push — master ( 334244...5c8872 )
by Владислав
04:42 queued 02:23
created
src/core/DeCaptchaWiki.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -29,160 +29,160 @@  discard block
 block discarded – undo
29 29
             'recognize_file'                                    => true,
30 30
             'recognize_data_file'                               => 'http://site.com/captcha.jpg',
31 31
             'recognize_data'                                    => [],
32
-            'field_main_name_'.($this->class)::ACTION_FIELD_KEY => [
32
+            'field_main_name_' . ($this->class)::ACTION_FIELD_KEY => [
33 33
                 'ru' => 'Ключ',
34 34
             ],
35
-            'field_main_desc_'.($this->class)::ACTION_FIELD_KEY => [
35
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_KEY => [
36 36
                 'ru' => 'Ключ от учетной записи',
37 37
             ],
38
-            'field_main_name_'.($this->class)::ACTION_FIELD_LANGUAGE => [
38
+            'field_main_name_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
39 39
                 'ru' => 'Язык',
40 40
             ],
41
-            'field_main_desc_'.($this->class)::ACTION_FIELD_LANGUAGE => [
41
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
42 42
                 'ru' => 'На каком языке текст на капче',
43 43
             ],
44
-            'field_main_name_'.($this->class)::ACTION_FIELD_FILE => [
44
+            'field_main_name_' . ($this->class)::ACTION_FIELD_FILE => [
45 45
                 'ru' => 'Картинка',
46 46
             ],
47
-            'field_main_desc_'.($this->class)::ACTION_FIELD_FILE => [
47
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_FILE => [
48 48
                 'ru' => 'Путь на файл с картинкой или ссылка на него',
49 49
             ],
50
-            'field_main_name_'.($this->class)::ACTION_FIELD_PHRASE => [
50
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PHRASE => [
51 51
                 'ru' => 'Несколько слов',
52 52
             ],
53
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PHRASE => [
53
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PHRASE => [
54 54
                 'ru' => 'Работник должен ввести текст с одним или несколькими пробелами',
55 55
             ],
56
-            'field_main_name_'.($this->class)::ACTION_FIELD_REGSENSE => [
56
+            'field_main_name_' . ($this->class)::ACTION_FIELD_REGSENSE => [
57 57
                 'ru' => 'Регистр',
58 58
             ],
59
-            'field_main_desc_'.($this->class)::ACTION_FIELD_REGSENSE => [
59
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_REGSENSE => [
60 60
                 'ru' => 'Работник должен ввсести ответ с учетом регистра',
61 61
             ],
62
-            'field_main_name_'.($this->class)::ACTION_FIELD_NUMERIC => [
62
+            'field_main_name_' . ($this->class)::ACTION_FIELD_NUMERIC => [
63 63
                 'ru' => 'Символы',
64 64
             ],
65
-            'field_main_desc_'.($this->class)::ACTION_FIELD_NUMERIC => [
65
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_NUMERIC => [
66 66
                 'ru' => 'Какие символы используется в капче',
67 67
             ],
68
-            'field_main_name_'.($this->class)::ACTION_FIELD_CALC => [
68
+            'field_main_name_' . ($this->class)::ACTION_FIELD_CALC => [
69 69
                 'ru' => 'Вычисление',
70 70
             ],
71
-            'field_main_desc_'.($this->class)::ACTION_FIELD_CALC => [
71
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_CALC => [
72 72
                 'ru' => 'На капче изображенно математичекая выражение и её необходимо решить',
73 73
             ],
74
-            'field_main_name_'.($this->class)::ACTION_FIELD_MIN_LEN => [
74
+            'field_main_name_' . ($this->class)::ACTION_FIELD_MIN_LEN => [
75 75
                 'ru' => 'Длина min',
76 76
             ],
77
-            'field_main_desc_'.($this->class)::ACTION_FIELD_MIN_LEN => [
77
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_MIN_LEN => [
78 78
                 'ru' => 'Минимальная длина капчи',
79 79
             ],
80
-            'field_main_name_'.($this->class)::ACTION_FIELD_MAX_LEN => [
80
+            'field_main_name_' . ($this->class)::ACTION_FIELD_MAX_LEN => [
81 81
                 'ru' => 'Длина max',
82 82
             ],
83
-            'field_main_desc_'.($this->class)::ACTION_FIELD_MAX_LEN => [
83
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_MAX_LEN => [
84 84
                 'ru' => 'Максимальная длина капчи',
85 85
             ],
86
-            'field_main_name_'.($this->class)::ACTION_FIELD_QUESTION => [
86
+            'field_main_name_' . ($this->class)::ACTION_FIELD_QUESTION => [
87 87
                 'ru' => 'Вопрос',
88 88
             ],
89
-            'field_main_desc_'.($this->class)::ACTION_FIELD_QUESTION => [
89
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_QUESTION => [
90 90
                 'ru' => 'На изображении задан вопрос, работник должен написать ответ',
91 91
             ],
92
-            'field_main_name_'.($this->class)::ACTION_FIELD_IS_RUSSIAN => [
92
+            'field_main_name_' . ($this->class)::ACTION_FIELD_IS_RUSSIAN => [
93 93
                 'ru' => 'Кириллица',
94 94
             ],
95
-            'field_main_desc_'.($this->class)::ACTION_FIELD_IS_RUSSIAN => [
95
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_IS_RUSSIAN => [
96 96
                 'ru' => 'На изображении присутствуют русские символы',
97 97
             ],
98
-            'field_main_name_'.($this->class)::ACTION_FIELD_LANGUAGE => [
98
+            'field_main_name_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
99 99
                 'ru' => 'Язык',
100 100
             ],
101
-            'field_main_desc_'.($this->class)::ACTION_FIELD_LANGUAGE => [
101
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_LANGUAGE => [
102 102
                 'ru' => 'Символы какого языка размещенны на капче',
103 103
             ],
104
-            'field_main_name_'.($this->class)::ACTION_FIELD_HEADER_ACAO => [
104
+            'field_main_name_' . ($this->class)::ACTION_FIELD_HEADER_ACAO => [
105 105
                 'ru' => 'Кросс-доменный',
106 106
             ],
107
-            'field_main_desc_'.($this->class)::ACTION_FIELD_HEADER_ACAO => [
107
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_HEADER_ACAO => [
108 108
                 'ru' => 'Необходимо для кросс-доменных AJAX запросов в браузерных приложениях.',
109 109
             ],
110
-            'field_main_name_'.($this->class)::ACTION_FIELD_INSTRUCTIONS => [
110
+            'field_main_name_' . ($this->class)::ACTION_FIELD_INSTRUCTIONS => [
111 111
                 'ru' => 'Инструкция',
112 112
             ],
113
-            'field_main_desc_'.($this->class)::ACTION_FIELD_INSTRUCTIONS => [
113
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_INSTRUCTIONS => [
114 114
                 'ru' => 'Текстовая капча или инструкция для прохождения капчи.',
115 115
             ],
116
-            'field_main_name_'.($this->class)::ACTION_FIELD_PINGBACK => [
116
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PINGBACK => [
117 117
                 'ru' => 'Ответ на',
118 118
             ],
119
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PINGBACK => [
119
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PINGBACK => [
120 120
                 'ru' => 'Указание для сервера, что после распознания изображения, нужно отправить ответ на указанный адрес.',
121 121
             ],
122
-            'field_main_name_'.($this->class)::ACTION_FIELD_LABEL => [
122
+            'field_main_name_' . ($this->class)::ACTION_FIELD_LABEL => [
123 123
                 'ru' => 'От куда',
124 124
             ],
125
-            'field_main_desc_'.($this->class)::ACTION_FIELD_LABEL => [
125
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_LABEL => [
126 126
                 'ru' => 'Пояснение от куда пришла капча ("vk", "google", "recaptcha", "yandex", "mailru", "yahoo" и т.д.).',
127 127
             ],
128
-            'field_main_name_'.($this->class)::ACTION_FIELD_PAGEURL => [
128
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PAGEURL => [
129 129
                 'ru' => 'Адрес',
130 130
             ],
131
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PAGEURL => [
131
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PAGEURL => [
132 132
                 'ru' => 'Адрес страницы на которой решается капча.',
133 133
             ],
134
-            'field_main_name_'.($this->class)::ACTION_FIELD_GOOGLEKEY => [
134
+            'field_main_name_' . ($this->class)::ACTION_FIELD_GOOGLEKEY => [
135 135
                 'ru' => 'Google key',
136 136
             ],
137
-            'field_main_desc_'.($this->class)::ACTION_FIELD_GOOGLEKEY => [
137
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_GOOGLEKEY => [
138 138
                 'ru' => 'Ключ-индентификатор рекапчи на целевой странице. <div class="g-recaptcha" data-sitekey="ВОТ_ЭТОТ"></div>',
139 139
             ],
140
-            'field_main_name_'.($this->class)::ACTION_FIELD_GOOGLETOKEN => [
140
+            'field_main_name_' . ($this->class)::ACTION_FIELD_GOOGLETOKEN => [
141 141
                 'ru' => 'Google token',
142 142
             ],
143
-            'field_main_desc_'.($this->class)::ACTION_FIELD_GOOGLETOKEN => [
143
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_GOOGLETOKEN => [
144 144
                 'ru' => 'Секретный токен для предыдущей версии рекапчи. В большинстве случаев сайты используют новую версию и этот токен не требуется. Секретный токен генерируется на сервере Google и вставляется на страницу в атрибуте data-stoken. Выглядит это примерно так: <script type="text/javascript" src="...." data-type="normal"  data-ray="..." async data-sitekey="..." data-stoken="ВОТ_ЭТОТ"></script> Токен действует пару минут после генерации, затем нужно снова зайти на страницу и получить его.',
145 145
             ],
146
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYTYPE => [
146
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYTYPE => [
147 147
                 'ru' => 'Тип прокси',
148 148
             ],
149
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYTYPE => [
149
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYTYPE => [
150 150
                 'ru' => 'Тип прокси (http, socks4, ...)',
151 151
             ],
152
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXY => [
152
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXY => [
153 153
                 'ru' => 'Адрес прокси',
154 154
             ],
155
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXY => [
155
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXY => [
156 156
                 'ru' => 'IP адрес прокси ipv4/ipv6.',
157 157
             ],
158
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYPORT => [
158
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYPORT => [
159 159
                 'ru' => 'Порт прокси',
160 160
             ],
161
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYPORT => [
161
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYPORT => [
162 162
                 'ru' => 'Порт прокси.',
163 163
             ],
164
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYLOGIN => [
164
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYLOGIN => [
165 165
                 'ru' => 'Логин прокси',
166 166
             ],
167
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYLOGIN => [
167
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYLOGIN => [
168 168
                 'ru' => 'Логин от прокси-сервера.',
169 169
             ],
170
-            'field_main_name_'.($this->class)::ACTION_FIELD_PROXYPASS => [
170
+            'field_main_name_' . ($this->class)::ACTION_FIELD_PROXYPASS => [
171 171
                 'ru' => 'Пароль прокси',
172 172
             ],
173
-            'field_main_desc_'.($this->class)::ACTION_FIELD_PROXYPASS => [
173
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_PROXYPASS => [
174 174
                 'ru' => 'Пароль от прокси-сервера.',
175 175
             ],
176
-            'field_main_name_'.($this->class)::ACTION_FIELD_USERAGENT => [
176
+            'field_main_name_' . ($this->class)::ACTION_FIELD_USERAGENT => [
177 177
                 'ru' => 'User-Agent браузера',
178 178
             ],
179
-            'field_main_desc_'.($this->class)::ACTION_FIELD_USERAGENT => [
179
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_USERAGENT => [
180 180
                 'ru' => 'User-Agent браузера, используемый в эмуляции. Необходимо использовать подпись современного браузера, иначе Google будет возвращать ошибку, требуя обновить браузер.',
181 181
             ],
182
-            'field_main_name_'.($this->class)::ACTION_FIELD_COOKIES => [
182
+            'field_main_name_' . ($this->class)::ACTION_FIELD_COOKIES => [
183 183
                 'ru' => 'Куки',
184 184
             ],
185
-            'field_main_desc_'.($this->class)::ACTION_FIELD_COOKIES => [
185
+            'field_main_desc_' . ($this->class)::ACTION_FIELD_COOKIES => [
186 186
                 'ru' => 'Дополнительные cookies которые мы должны использовать во время взаимодействия с целевой страницей.',
187 187
             ],
188 188
             'table_th_name' => [
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public function getText($name, $separator = '; ')
304 304
     {
305
-        $getResult = function ($name, $texts) {
305
+        $getResult = function($name, $texts) {
306 306
             if (is_array($name)) {
307 307
                 $name = implode('_', $name);
308 308
             }
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
 
332 332
     private function viewInstall()
333 333
     {
334
-        $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/).".PHP_EOL;
334
+        $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/)." . PHP_EOL;
335 335
         $str .= PHP_EOL;
336
-        $str .= "{$this->getText(['install', 'start'])}".PHP_EOL;
337
-        $str .= '```'.PHP_EOL;
338
-        $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"'.PHP_EOL;
339
-        $str .= '```'.PHP_EOL;
340
-        $str .= "{$this->getText(['install', 'add'])}".PHP_EOL;
341
-        $str .= '```'.PHP_EOL;
342
-        $str .= '"jumper423/decaptcha": "*"'.PHP_EOL;
343
-        $str .= '```'.PHP_EOL;
344
-        $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`.".PHP_EOL;
336
+        $str .= "{$this->getText(['install', 'start'])}" . PHP_EOL;
337
+        $str .= '```' . PHP_EOL;
338
+        $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"' . PHP_EOL;
339
+        $str .= '```' . PHP_EOL;
340
+        $str .= "{$this->getText(['install', 'add'])}" . PHP_EOL;
341
+        $str .= '```' . PHP_EOL;
342
+        $str .= '"jumper423/decaptcha": "*"' . PHP_EOL;
343
+        $str .= '```' . PHP_EOL;
344
+        $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`." . PHP_EOL;
345 345
 
346 346
         return $str;
347 347
     }
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
     {
351 351
         $rc = (new \ReflectionClass($this->class));
352 352
 
353
-        $str = "#####{$this->getText(['example', 'initialization'])}".PHP_EOL;
354
-        $str .= "{$this->getText(['example', 'initialization', 'desc'])}".PHP_EOL;
355
-        $str .= '```'.PHP_EOL;
356
-        $str .= "use {$rc->getName()};".PHP_EOL;
357
-        $str .= ''.PHP_EOL;
358
-        $str .= '$captcha = new '.$rc->getShortName().'(['.PHP_EOL;
353
+        $str = "#####{$this->getText(['example', 'initialization'])}" . PHP_EOL;
354
+        $str .= "{$this->getText(['example', 'initialization', 'desc'])}" . PHP_EOL;
355
+        $str .= '```' . PHP_EOL;
356
+        $str .= "use {$rc->getName()};" . PHP_EOL;
357
+        $str .= '' . PHP_EOL;
358
+        $str .= '$captcha = new ' . $rc->getShortName() . '([' . PHP_EOL;
359 359
         foreach ($this->texts['constructor_data'] as $key => $val) {
360 360
             $str .= "    {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => ";
361 361
             if (is_string($val)) {
@@ -363,14 +363,14 @@  discard block
 block discarded – undo
363 363
             } else {
364 364
                 $str .= "{$val}";
365 365
             }
366
-            $str .= ','.PHP_EOL;
366
+            $str .= ',' . PHP_EOL;
367 367
         }
368
-        $str .= ']);'.PHP_EOL;
369
-        $str .= '```'.PHP_EOL;
368
+        $str .= ']);' . PHP_EOL;
369
+        $str .= '```' . PHP_EOL;
370 370
 
371
-        $str .= "#####{$this->getText(['example', 'recognize'])}".PHP_EOL;
372
-        $str .= "{$this->getText(['example', 'recognize', 'desc'])}".PHP_EOL;
373
-        $str .= '```'.PHP_EOL;
371
+        $str .= "#####{$this->getText(['example', 'recognize'])}" . PHP_EOL;
372
+        $str .= "{$this->getText(['example', 'recognize', 'desc'])}" . PHP_EOL;
373
+        $str .= '```' . PHP_EOL;
374 374
         $str .= 'if ($captcha->recognize(';
375 375
         if ($this->texts['recognize_file']) {
376 376
             $str .= "'{$this->getText(['recognize', 'data', 'file'])}'";
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             if ($this->texts['recognize_file']) {
380 380
                 $str .= ', ';
381 381
             }
382
-            $str .= '['.PHP_EOL;
382
+            $str .= '[' . PHP_EOL;
383 383
             foreach ($this->texts['recognize_data'] as $key => $val) {
384 384
                 $str .= "    {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => ";
385 385
                 if (is_string($val)) {
@@ -387,46 +387,46 @@  discard block
 block discarded – undo
387 387
                 } else {
388 388
                     $str .= "{$val}";
389 389
                 }
390
-                $str .= ','.PHP_EOL;
390
+                $str .= ',' . PHP_EOL;
391 391
             }
392 392
             $str .= ']';
393 393
         }
394
-        $str .= ')) {'.PHP_EOL;
395
-        $str .= '    $code = $captcha->getCode();'.PHP_EOL;
396
-        $str .= '} else {'.PHP_EOL;
397
-        $str .= '    $error = $captcha->getError();'.PHP_EOL;
398
-        $str .= '}'.PHP_EOL;
399
-        $str .= '```'.PHP_EOL;
394
+        $str .= ')) {' . PHP_EOL;
395
+        $str .= '    $code = $captcha->getCode();' . PHP_EOL;
396
+        $str .= '} else {' . PHP_EOL;
397
+        $str .= '    $error = $captcha->getError();' . PHP_EOL;
398
+        $str .= '}' . PHP_EOL;
399
+        $str .= '```' . PHP_EOL;
400 400
 
401 401
         if (in_array('notTrue', get_class_methods($this->class))) {
402
-            $str .= "#####{$this->getText(['example', 'nottrue'])}".PHP_EOL;
403
-            $str .= "{$this->getText(['example', 'nottrue', 'desc'])}".PHP_EOL;
404
-            $str .= '```'.PHP_EOL;
405
-            $str .= '$captcha->notTrue();'.PHP_EOL;
406
-            $str .= '```'.PHP_EOL;
402
+            $str .= "#####{$this->getText(['example', 'nottrue'])}" . PHP_EOL;
403
+            $str .= "{$this->getText(['example', 'nottrue', 'desc'])}" . PHP_EOL;
404
+            $str .= '```' . PHP_EOL;
405
+            $str .= '$captcha->notTrue();' . PHP_EOL;
406
+            $str .= '```' . PHP_EOL;
407 407
         }
408 408
 
409 409
         if (in_array('getBalance', get_class_methods($this->class))) {
410
-            $str .= "#####{$this->getText(['example', 'balance'])}".PHP_EOL;
411
-            $str .= '```'.PHP_EOL;
412
-            $str .= '$balance = $captcha->getBalance();'.PHP_EOL;
413
-            $str .= '```'.PHP_EOL;
410
+            $str .= "#####{$this->getText(['example', 'balance'])}" . PHP_EOL;
411
+            $str .= '```' . PHP_EOL;
412
+            $str .= '$balance = $captcha->getBalance();' . PHP_EOL;
413
+            $str .= '```' . PHP_EOL;
414 414
         }
415 415
 
416 416
         if ($this->getText(['example', 'error', 'lang', 'if'])) {
417
-            $str .= "#####{$this->getText(['example', 'error', 'lang'])}".PHP_EOL;
418
-            $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}".PHP_EOL;
419
-            $str .= '```'.PHP_EOL;
420
-            $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);'.PHP_EOL;
421
-            $str .= '```'.PHP_EOL;
417
+            $str .= "#####{$this->getText(['example', 'error', 'lang'])}" . PHP_EOL;
418
+            $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}" . PHP_EOL;
419
+            $str .= '```' . PHP_EOL;
420
+            $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);' . PHP_EOL;
421
+            $str .= '```' . PHP_EOL;
422 422
         }
423 423
 
424
-        $str .= "#####{$this->getText(['example', 'error', 'interception'])}".PHP_EOL;
425
-        $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}".PHP_EOL;
426
-        $str .= '```'.PHP_EOL;
427
-        $str .= '$captcha->setCauseAnError(true);'.PHP_EOL;
424
+        $str .= "#####{$this->getText(['example', 'error', 'interception'])}" . PHP_EOL;
425
+        $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}" . PHP_EOL;
426
+        $str .= '```' . PHP_EOL;
427
+        $str .= '$captcha->setCauseAnError(true);' . PHP_EOL;
428 428
         $str .= PHP_EOL;
429
-        $str .= 'try {'.PHP_EOL;
429
+        $str .= 'try {' . PHP_EOL;
430 430
         $str .= '    $captcha->recognize(';
431 431
         if ($this->texts['recognize_file']) {
432 432
             $str .= "'{$this->getText(['recognize', 'data', 'file'])}'";
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             if ($this->texts['recognize_file']) {
436 436
                 $str .= ', ';
437 437
             }
438
-            $str .= '['.PHP_EOL;
438
+            $str .= '[' . PHP_EOL;
439 439
             foreach ($this->texts['recognize_data'] as $key => $val) {
440 440
                 $str .= "       {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => ";
441 441
                 if (is_string($val)) {
@@ -443,24 +443,24 @@  discard block
 block discarded – undo
443 443
                 } else {
444 444
                     $str .= "{$val}";
445 445
                 }
446
-                $str .= ','.PHP_EOL;
446
+                $str .= ',' . PHP_EOL;
447 447
             }
448 448
             $str .= '    ]';
449 449
         }
450
-        $str .= ');'.PHP_EOL;
451
-        $str .= '    $code = $captcha->getCode();'.PHP_EOL;
452
-        $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {'.PHP_EOL;
453
-        $str .= '    ...'.PHP_EOL;
454
-        $str .= '}'.PHP_EOL;
455
-        $str .= '```'.PHP_EOL;
450
+        $str .= ');' . PHP_EOL;
451
+        $str .= '    $code = $captcha->getCode();' . PHP_EOL;
452
+        $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {' . PHP_EOL;
453
+        $str .= '    ...' . PHP_EOL;
454
+        $str .= '}' . PHP_EOL;
455
+        $str .= '```' . PHP_EOL;
456 456
 
457 457
         return $str;
458 458
     }
459 459
 
460 460
     private function viewFields()
461 461
     {
462
-        $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;
463
-        $str .= ' --- | --- | --- | --- | --- | --- | --- '.PHP_EOL;
462
+        $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;
463
+        $str .= ' --- | --- | --- | --- | --- | --- | --- ' . PHP_EOL;
464 464
         foreach ($this->class->actions[($this->class)::ACTION_RECOGNIZE][($this->class)::ACTION_FIELDS] as $param => $setting) {
465 465
             if (array_key_exists(($this->class)::ACTION_FIELDS, $setting) && is_array($setting[($this->class)::ACTION_FIELDS])) {
466 466
                 foreach ($setting[($this->class)::ACTION_FIELDS] as $param1 => $setting1) {
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
         $str = " {$this->getText(['field', 'main', 'name', $param])} |";
485 485
         $str .= " {$this->getNameConst('ACTION_FIELD_', $param)} |";
486 486
 //        if (isset($setting[($this->class)::PARAM_SLUG_TYPE])) {
487
-            $str .= ' '.substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[($this->class)::PARAM_SLUG_TYPE]), 17).' |';
487
+            $str .= ' ' . substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[($this->class)::PARAM_SLUG_TYPE]), 17) . ' |';
488 488
 //        } else {
489 489
 //            $str .= ' |';
490 490
 //        }
491
-        $str .= ' '.(array_key_exists(($this->class)::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-').' |';
492
-        $str .= ' '.(array_key_exists(($this->class)::PARAM_SLUG_DEFAULT, $setting) ? $setting[($this->class)::PARAM_SLUG_DEFAULT] : '').' |';
491
+        $str .= ' ' . (array_key_exists(($this->class)::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') . ' |';
492
+        $str .= ' ' . (array_key_exists(($this->class)::PARAM_SLUG_DEFAULT, $setting) ? $setting[($this->class)::PARAM_SLUG_DEFAULT] : '') . ' |';
493 493
         $str .= " {$this->getText(['field', 'slug', ($this->class)::PARAM_SLUG_ENUM, $param])} |";
494 494
         $str .= " {$this->getText(['field', 'main', 'desc', $param])} |";
495 495
         $str .= PHP_EOL;
@@ -511,22 +511,22 @@  discard block
 block discarded – undo
511 511
 
512 512
     public function view()
513 513
     {
514
-        $str = $this->getText(['service', 'name']).PHP_EOL;
515
-        $str .= '=============='.PHP_EOL;
516
-        $str .= "###{$this->getText(['slug', 'link'])}".PHP_EOL;
517
-        $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})".PHP_EOL.PHP_EOL;
518
-        $str .= "###{$this->getText(['slug', 'service', 'desc'])}".PHP_EOL;
519
-        $str .= "{$this->getText(['service', 'desc'])}".PHP_EOL.PHP_EOL;
520
-        $str .= "###{$this->getText(['slug', 'price'])}".PHP_EOL;
521
-        $str .= "{$this->getText(['recognize', 'price'])}".PHP_EOL.PHP_EOL;
522
-        $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}".PHP_EOL;
523
-        $str .= "{$this->getText(['recognize', 'desc'])}".PHP_EOL.PHP_EOL;
524
-        $str .= "###{$this->getText(['install'])}".PHP_EOL;
525
-        $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL;
526
-        $str .= "###{$this->getText(['example'])}".PHP_EOL;
527
-        $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL;
528
-        $str .= "###{$this->getText(['slug', 'fields', 'desc'])}".PHP_EOL;
529
-        $str .= $this->viewFields().PHP_EOL;
514
+        $str = $this->getText(['service', 'name']) . PHP_EOL;
515
+        $str .= '==============' . PHP_EOL;
516
+        $str .= "###{$this->getText(['slug', 'link'])}" . PHP_EOL;
517
+        $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})" . PHP_EOL . PHP_EOL;
518
+        $str .= "###{$this->getText(['slug', 'service', 'desc'])}" . PHP_EOL;
519
+        $str .= "{$this->getText(['service', 'desc'])}" . PHP_EOL . PHP_EOL;
520
+        $str .= "###{$this->getText(['slug', 'price'])}" . PHP_EOL;
521
+        $str .= "{$this->getText(['recognize', 'price'])}" . PHP_EOL . PHP_EOL;
522
+        $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}" . PHP_EOL;
523
+        $str .= "{$this->getText(['recognize', 'desc'])}" . PHP_EOL . PHP_EOL;
524
+        $str .= "###{$this->getText(['install'])}" . PHP_EOL;
525
+        $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL;
526
+        $str .= "###{$this->getText(['example'])}" . PHP_EOL;
527
+        $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL;
528
+        $str .= "###{$this->getText(['slug', 'fields', 'desc'])}" . PHP_EOL;
529
+        $str .= $this->viewFields() . PHP_EOL;
530 530
 
531 531
         return $str;
532 532
     }
@@ -538,6 +538,6 @@  discard block
 block discarded – undo
538 538
 
539 539
     public function save()
540 540
     {
541
-        file_put_contents(__DIR__.'/../../docs/'.$this->getFileName().'-'.$this->lang.'.md', $this->view());
541
+        file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName() . '-' . $this->lang . '.md', $this->view());
542 542
     }
543 543
 }
Please login to merge, or discard this patch.