@@ -11,7 +11,7 @@ |
||
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('Нулевой либо отрицательный баланс', $captcha->getError()); |
@@ -31,160 +31,160 @@ discard block |
||
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' => [ |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function getText($name, $separator = '; ') |
306 | 306 | { |
307 | - $getResult = function ($name, $texts) { |
|
307 | + $getResult = function($name, $texts) { |
|
308 | 308 | if (is_array($name)) { |
309 | 309 | $name = implode('_', $name); |
310 | 310 | } |
@@ -333,17 +333,17 @@ discard block |
||
333 | 333 | |
334 | 334 | private function viewInstall() |
335 | 335 | { |
336 | - $str = "{$this->getText(['install','preferred'])} [composer](http://getcomposer.org/download/).".PHP_EOL; |
|
336 | + $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/)." . PHP_EOL; |
|
337 | 337 | $str .= PHP_EOL; |
338 | - $str .= "{$this->getText(['install','start'])}".PHP_EOL; |
|
339 | - $str .= '```'.PHP_EOL; |
|
340 | - $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"'.PHP_EOL; |
|
341 | - $str .= '```'.PHP_EOL; |
|
342 | - $str .= "{$this->getText(['install','add'])}".PHP_EOL; |
|
343 | - $str .= '```'.PHP_EOL; |
|
344 | - $str .= '"jumper423/decaptcha": "*"'.PHP_EOL; |
|
345 | - $str .= '```'.PHP_EOL; |
|
346 | - $str .= "{$this->getText(['install','add', 'file'])} `composer.json`.".PHP_EOL; |
|
338 | + $str .= "{$this->getText(['install', 'start'])}" . PHP_EOL; |
|
339 | + $str .= '```' . PHP_EOL; |
|
340 | + $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"' . PHP_EOL; |
|
341 | + $str .= '```' . PHP_EOL; |
|
342 | + $str .= "{$this->getText(['install', 'add'])}" . PHP_EOL; |
|
343 | + $str .= '```' . PHP_EOL; |
|
344 | + $str .= '"jumper423/decaptcha": "*"' . PHP_EOL; |
|
345 | + $str .= '```' . PHP_EOL; |
|
346 | + $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`." . PHP_EOL; |
|
347 | 347 | return $str; |
348 | 348 | } |
349 | 349 | |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | { |
352 | 352 | $rc = (new \ReflectionClass($this->class)); |
353 | 353 | |
354 | - $str = "#####{$this->getText(['example', 'initialization'])}".PHP_EOL; |
|
355 | - $str .= "{$this->getText(['example', 'initialization','desc'])}".PHP_EOL; |
|
356 | - $str .= '```'.PHP_EOL; |
|
357 | - $str .= "use {$rc->getName()};".PHP_EOL; |
|
358 | - $str .= ''.PHP_EOL; |
|
359 | - $str .= '$captcha = new '.$rc->getShortName().'(['.PHP_EOL; |
|
354 | + $str = "#####{$this->getText(['example', 'initialization'])}" . PHP_EOL; |
|
355 | + $str .= "{$this->getText(['example', 'initialization', 'desc'])}" . PHP_EOL; |
|
356 | + $str .= '```' . PHP_EOL; |
|
357 | + $str .= "use {$rc->getName()};" . PHP_EOL; |
|
358 | + $str .= '' . PHP_EOL; |
|
359 | + $str .= '$captcha = new ' . $rc->getShortName() . '([' . PHP_EOL; |
|
360 | 360 | foreach ($this->texts['constructor_data'] as $key => $val) { |
361 | 361 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
362 | 362 | if (is_string($val)) { |
@@ -364,14 +364,14 @@ discard block |
||
364 | 364 | } else { |
365 | 365 | $str .= "{$val}"; |
366 | 366 | } |
367 | - $str .= ','.PHP_EOL; |
|
367 | + $str .= ',' . PHP_EOL; |
|
368 | 368 | } |
369 | - $str .= ']);'.PHP_EOL; |
|
370 | - $str .= '```'.PHP_EOL; |
|
369 | + $str .= ']);' . PHP_EOL; |
|
370 | + $str .= '```' . PHP_EOL; |
|
371 | 371 | |
372 | - $str .= "#####{$this->getText(['example', 'recognize'])}".PHP_EOL; |
|
373 | - $str .= "{$this->getText(['example', 'recognize','desc'])}".PHP_EOL; |
|
374 | - $str .= '```'.PHP_EOL; |
|
372 | + $str .= "#####{$this->getText(['example', 'recognize'])}" . PHP_EOL; |
|
373 | + $str .= "{$this->getText(['example', 'recognize', 'desc'])}" . PHP_EOL; |
|
374 | + $str .= '```' . PHP_EOL; |
|
375 | 375 | $str .= 'if ($captcha->recognize('; |
376 | 376 | if ($this->texts['recognize_file']) { |
377 | 377 | $str .= "'{$this->getText(['recognize', 'data', 'file'])}'"; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | if ($this->texts['recognize_file']) { |
381 | 381 | $str .= ', '; |
382 | 382 | } |
383 | - $str .= '['.PHP_EOL; |
|
383 | + $str .= '[' . PHP_EOL; |
|
384 | 384 | foreach ($this->texts['recognize_data'] as $key => $val) { |
385 | 385 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
386 | 386 | if (is_string($val)) { |
@@ -388,20 +388,20 @@ discard block |
||
388 | 388 | } else { |
389 | 389 | $str .= "{$val}"; |
390 | 390 | } |
391 | - $str .= ','.PHP_EOL; |
|
391 | + $str .= ',' . PHP_EOL; |
|
392 | 392 | } |
393 | 393 | $str .= ']'; |
394 | 394 | } |
395 | - $str .= ')) {'.PHP_EOL; |
|
396 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
397 | - $str .= '} else {'.PHP_EOL; |
|
398 | - $str .= ' $error = $captcha->getError());'.PHP_EOL; |
|
399 | - $str .= '}'.PHP_EOL; |
|
400 | - $str .= '```'.PHP_EOL; |
|
395 | + $str .= ')) {' . PHP_EOL; |
|
396 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
397 | + $str .= '} else {' . PHP_EOL; |
|
398 | + $str .= ' $error = $captcha->getError());' . PHP_EOL; |
|
399 | + $str .= '}' . PHP_EOL; |
|
400 | + $str .= '```' . PHP_EOL; |
|
401 | 401 | |
402 | 402 | if (in_array('notTrue', get_class_methods($this->class))) { |
403 | 403 | $str .= "#####{$this->getText(['example', 'nottrue'])}" . PHP_EOL; |
404 | - $str .= "{$this->getText(['example', 'nottrue','desc'])}" . PHP_EOL; |
|
404 | + $str .= "{$this->getText(['example', 'nottrue', 'desc'])}" . PHP_EOL; |
|
405 | 405 | $str .= '```' . PHP_EOL; |
406 | 406 | $str .= '$captcha->notTrue();' . PHP_EOL; |
407 | 407 | $str .= '```' . PHP_EOL; |
@@ -415,19 +415,19 @@ discard block |
||
415 | 415 | } |
416 | 416 | |
417 | 417 | if ($this->getText(['example', 'error', 'lang', 'if'])) { |
418 | - $str .= "#####{$this->getText(['example', 'error', 'lang'])}".PHP_EOL; |
|
419 | - $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}".PHP_EOL; |
|
420 | - $str .= '```'.PHP_EOL; |
|
421 | - $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);'.PHP_EOL; |
|
422 | - $str .= '```'.PHP_EOL; |
|
418 | + $str .= "#####{$this->getText(['example', 'error', 'lang'])}" . PHP_EOL; |
|
419 | + $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}" . PHP_EOL; |
|
420 | + $str .= '```' . PHP_EOL; |
|
421 | + $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);' . PHP_EOL; |
|
422 | + $str .= '```' . PHP_EOL; |
|
423 | 423 | } |
424 | 424 | |
425 | - $str .= "#####{$this->getText(['example', 'error','interception'])}" . PHP_EOL; |
|
426 | - $str .= "{$this->getText(['example', 'error','interception','desc'])}".PHP_EOL; |
|
425 | + $str .= "#####{$this->getText(['example', 'error', 'interception'])}" . PHP_EOL; |
|
426 | + $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}" . PHP_EOL; |
|
427 | 427 | $str .= '```' . PHP_EOL; |
428 | - $str .= '$captcha->setCauseAnError(true);'.PHP_EOL; |
|
428 | + $str .= '$captcha->setCauseAnError(true);' . PHP_EOL; |
|
429 | 429 | $str .= PHP_EOL; |
430 | - $str .= 'try {'.PHP_EOL; |
|
430 | + $str .= 'try {' . PHP_EOL; |
|
431 | 431 | $str .= ' $captcha->recognize('; |
432 | 432 | if ($this->texts['recognize_file']) { |
433 | 433 | $str .= "'{$this->getText(['recognize', 'data', 'file'])}'"; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | if ($this->texts['recognize_file']) { |
437 | 437 | $str .= ', '; |
438 | 438 | } |
439 | - $str .= '['.PHP_EOL; |
|
439 | + $str .= '[' . PHP_EOL; |
|
440 | 440 | foreach ($this->texts['recognize_data'] as $key => $val) { |
441 | 441 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
442 | 442 | if (is_string($val)) { |
@@ -444,23 +444,23 @@ discard block |
||
444 | 444 | } else { |
445 | 445 | $str .= "{$val}"; |
446 | 446 | } |
447 | - $str .= ','.PHP_EOL; |
|
447 | + $str .= ',' . PHP_EOL; |
|
448 | 448 | } |
449 | 449 | $str .= ' ]'; |
450 | 450 | } |
451 | - $str .= ');'.PHP_EOL; |
|
452 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
453 | - $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {'.PHP_EOL; |
|
454 | - $str .= ' ...'.PHP_EOL; |
|
455 | - $str .= '}'.PHP_EOL; |
|
451 | + $str .= ');' . PHP_EOL; |
|
452 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
453 | + $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {' . PHP_EOL; |
|
454 | + $str .= ' ...' . PHP_EOL; |
|
455 | + $str .= '}' . PHP_EOL; |
|
456 | 456 | $str .= '```' . PHP_EOL; |
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) { |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | { |
484 | 484 | $str = " {$this->getText(['field', 'main', 'name', $param])} |"; |
485 | 485 | $str .= " {$this->getNameConst('ACTION_FIELD_', $param)} |"; |
486 | - $str .= ' '.substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[($this->class)::PARAM_SLUG_TYPE]), 17).' |'; |
|
487 | - $str .= ' '.(array_key_exists(($this->class)::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-').' |'; |
|
488 | - $str .= ' '.(array_key_exists(($this->class)::PARAM_SLUG_DEFAULT, $setting) ? $setting[($this->class)::PARAM_SLUG_DEFAULT] : '').' |'; |
|
486 | + $str .= ' ' . substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[($this->class)::PARAM_SLUG_TYPE]), 17) . ' |'; |
|
487 | + $str .= ' ' . (array_key_exists(($this->class)::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') . ' |'; |
|
488 | + $str .= ' ' . (array_key_exists(($this->class)::PARAM_SLUG_DEFAULT, $setting) ? $setting[($this->class)::PARAM_SLUG_DEFAULT] : '') . ' |'; |
|
489 | 489 | $str .= " {$this->getText(['field', 'slug', ($this->class)::PARAM_SLUG_ENUM, $param])} |"; |
490 | 490 | $str .= " {$this->getText(['field', 'main', 'desc', $param])} |"; |
491 | 491 | $str .= PHP_EOL; |
@@ -507,31 +507,31 @@ discard block |
||
507 | 507 | |
508 | 508 | public function view() |
509 | 509 | { |
510 | - $str = $this->getText(['service', 'name']).PHP_EOL; |
|
511 | - $str .= '=============='.PHP_EOL; |
|
512 | - $str .= "###{$this->getText(['slug', 'link'])}".PHP_EOL; |
|
513 | - $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})".PHP_EOL.PHP_EOL; |
|
514 | - $str .= "###{$this->getText(['slug', 'service', 'desc'])}".PHP_EOL; |
|
515 | - $str .= "{$this->getText(['service', 'desc'])}".PHP_EOL.PHP_EOL; |
|
516 | - $str .= "###{$this->getText(['slug', 'price'])}".PHP_EOL; |
|
517 | - $str .= "{$this->getText(['recognize', 'price'])}".PHP_EOL.PHP_EOL; |
|
518 | - $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}".PHP_EOL; |
|
519 | - $str .= "{$this->getText(['recognize', 'desc'])}".PHP_EOL.PHP_EOL; |
|
520 | - $str .= "###{$this->getText(['install'])}".PHP_EOL; |
|
521 | - $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL; |
|
522 | - $str .= "###{$this->getText(['example'])}".PHP_EOL; |
|
523 | - $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL; |
|
524 | - $str .= "###{$this->getText(['slug', 'fields', 'desc'])}".PHP_EOL; |
|
525 | - $str .= $this->viewFields().PHP_EOL; |
|
510 | + $str = $this->getText(['service', 'name']) . PHP_EOL; |
|
511 | + $str .= '==============' . PHP_EOL; |
|
512 | + $str .= "###{$this->getText(['slug', 'link'])}" . PHP_EOL; |
|
513 | + $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})" . PHP_EOL . PHP_EOL; |
|
514 | + $str .= "###{$this->getText(['slug', 'service', 'desc'])}" . PHP_EOL; |
|
515 | + $str .= "{$this->getText(['service', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
516 | + $str .= "###{$this->getText(['slug', 'price'])}" . PHP_EOL; |
|
517 | + $str .= "{$this->getText(['recognize', 'price'])}" . PHP_EOL . PHP_EOL; |
|
518 | + $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}" . PHP_EOL; |
|
519 | + $str .= "{$this->getText(['recognize', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
520 | + $str .= "###{$this->getText(['install'])}" . PHP_EOL; |
|
521 | + $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL; |
|
522 | + $str .= "###{$this->getText(['example'])}" . PHP_EOL; |
|
523 | + $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL; |
|
524 | + $str .= "###{$this->getText(['slug', 'fields', 'desc'])}" . PHP_EOL; |
|
525 | + $str .= $this->viewFields() . PHP_EOL; |
|
526 | 526 | |
527 | 527 | return $str; |
528 | 528 | } |
529 | 529 | |
530 | - public function getFileName(){ |
|
530 | + public function getFileName() { |
|
531 | 531 | return (new \ReflectionClass($this->class))->getShortName(); |
532 | 532 | } |
533 | 533 | |
534 | - public function save(){ |
|
535 | - file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName() . '-'.$this->lang.'.md', $this->view()); |
|
534 | + public function save() { |
|
535 | + file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName() . '-' . $this->lang . '.md', $this->view()); |
|
536 | 536 | } |
537 | 537 | } |