@@ -17,7 +17,7 @@ discard block |
||
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 |
||
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()); |
@@ -19,7 +19,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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)); |
@@ -11,7 +11,7 @@ discard block |
||
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 |
||
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()); |
@@ -101,8 +101,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -24,23 +24,23 @@ |
||
24 | 24 | |
25 | 25 | foreach (['ru', 'en'] as $lang) { |
26 | 26 | foreach ([ |
27 | - new \jumper423\decaptcha\services\RuCaptcha([]), |
|
28 | - new \jumper423\decaptcha\services\RuCaptchaReCaptcha([]), |
|
29 | - new \jumper423\decaptcha\services\RuCaptchaInstruction([]), |
|
30 | - new \jumper423\decaptcha\services\RuCaptchaGrid([]), |
|
31 | - new \jumper423\decaptcha\services\RuCaptchaClick([]), |
|
32 | - new \jumper423\decaptcha\services\TwoCaptcha([]), |
|
33 | - new \jumper423\decaptcha\services\TwoCaptchaReCaptcha([]), |
|
34 | - new \jumper423\decaptcha\services\TwoCaptchaInstruction([]), |
|
35 | - new \jumper423\decaptcha\services\TwoCaptchaGrid([]), |
|
36 | - new \jumper423\decaptcha\services\TwoCaptchaClick([]), |
|
37 | - new \jumper423\decaptcha\services\Anticaptcha([]), |
|
38 | - new \jumper423\decaptcha\services\AnticaptchaReCaptcha([]), |
|
39 | - new \jumper423\decaptcha\services\AnticaptchaReCaptchaProxeless([]), |
|
40 | - new \jumper423\decaptcha\services\Captcha24([]), |
|
41 | - new \jumper423\decaptcha\services\Pixodrom([]), |
|
42 | - new \jumper423\decaptcha\services\Ripcaptcha([]), |
|
43 | - ] as $class) { |
|
27 | + new \jumper423\decaptcha\services\RuCaptcha([]), |
|
28 | + new \jumper423\decaptcha\services\RuCaptchaReCaptcha([]), |
|
29 | + new \jumper423\decaptcha\services\RuCaptchaInstruction([]), |
|
30 | + new \jumper423\decaptcha\services\RuCaptchaGrid([]), |
|
31 | + new \jumper423\decaptcha\services\RuCaptchaClick([]), |
|
32 | + new \jumper423\decaptcha\services\TwoCaptcha([]), |
|
33 | + new \jumper423\decaptcha\services\TwoCaptchaReCaptcha([]), |
|
34 | + new \jumper423\decaptcha\services\TwoCaptchaInstruction([]), |
|
35 | + new \jumper423\decaptcha\services\TwoCaptchaGrid([]), |
|
36 | + new \jumper423\decaptcha\services\TwoCaptchaClick([]), |
|
37 | + new \jumper423\decaptcha\services\Anticaptcha([]), |
|
38 | + new \jumper423\decaptcha\services\AnticaptchaReCaptcha([]), |
|
39 | + new \jumper423\decaptcha\services\AnticaptchaReCaptchaProxeless([]), |
|
40 | + new \jumper423\decaptcha\services\Captcha24([]), |
|
41 | + new \jumper423\decaptcha\services\Pixodrom([]), |
|
42 | + new \jumper423\decaptcha\services\Ripcaptcha([]), |
|
43 | + ] as $class) { |
|
44 | 44 | $tt = $class->getWiki($lang); |
45 | 45 | $tt->save(); |
46 | 46 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__.'/../vendor/autoload.php'; |
|
3 | +include_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | $mainWiki = new \jumper423\decaptcha\core\DeCaptchaWikiMain(new \jumper423\decaptcha\services\RuCaptcha([])); |
6 | 6 | foreach (['ru', 'en'] as $lang) { |
@@ -519,14 +519,14 @@ |
||
519 | 519 | $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../blob/master/docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
520 | 520 | $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}".PHP_EOL; |
521 | 521 | foreach ([ |
522 | - ['slug', 'link'], |
|
523 | - ['slug', 'service', 'desc'], |
|
524 | - ['slug', 'price'], |
|
525 | - ['slug', 'recognize', 'desc'], |
|
526 | - ['install'], |
|
527 | - ['example'], |
|
528 | - ['slug', 'fields', 'desc'], |
|
529 | - ] as $anchor) { |
|
522 | + ['slug', 'link'], |
|
523 | + ['slug', 'service', 'desc'], |
|
524 | + ['slug', 'price'], |
|
525 | + ['slug', 'recognize', 'desc'], |
|
526 | + ['install'], |
|
527 | + ['example'], |
|
528 | + ['slug', 'fields', 'desc'], |
|
529 | + ] as $anchor) { |
|
530 | 530 | $str .= " + [{$this->getText($anchor)}](#".implode('-', explode(' ', $this->getText($anchor))).')'.PHP_EOL; |
531 | 531 | } |
532 | 532 | if ($this->getText(['menu', 'from_service'])) { |
@@ -14,6 +14,9 @@ discard block |
||
14 | 14 | protected $class; |
15 | 15 | protected $lang = 'en'; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $lang |
|
19 | + */ |
|
17 | 20 | public function setLang($lang) |
18 | 21 | { |
19 | 22 | $this->lang = $lang; |
@@ -312,10 +315,10 @@ discard block |
||
312 | 315 | } |
313 | 316 | |
314 | 317 | /** |
315 | - * @param string|array $name |
|
318 | + * @param string[] $name |
|
316 | 319 | * @param string $separator |
317 | 320 | * |
318 | - * @return string|array |
|
321 | + * @return string |
|
319 | 322 | */ |
320 | 323 | public function getText($name, $separator = '; ') |
321 | 324 | { |
@@ -541,6 +544,9 @@ discard block |
||
541 | 544 | return $str; |
542 | 545 | } |
543 | 546 | |
547 | + /** |
|
548 | + * @param string $keyMask |
|
549 | + */ |
|
544 | 550 | protected function getNameConst($keyMask, $value) |
545 | 551 | { |
546 | 552 | $class = $this->class; |
@@ -578,6 +584,9 @@ discard block |
||
578 | 584 | return $str; |
579 | 585 | } |
580 | 586 | |
587 | + /** |
|
588 | + * @param string $lang |
|
589 | + */ |
|
581 | 590 | public function getFileName($lang = null) |
582 | 591 | { |
583 | 592 | if (is_null($lang)) { |
@@ -29,160 +29,160 @@ discard block |
||
29 | 29 | 'recognize_file' => true, |
30 | 30 | 'recognize_data_file' => 'http://site.com/captcha.jpg', |
31 | 31 | 'recognize_data' => [], |
32 | - 'field_main_name_'.$class::ACTION_FIELD_KEY => [ |
|
32 | + 'field_main_name_' . $class::ACTION_FIELD_KEY => [ |
|
33 | 33 | 'ru' => 'Ключ', |
34 | 34 | ], |
35 | - 'field_main_desc_'.$class::ACTION_FIELD_KEY => [ |
|
35 | + 'field_main_desc_' . $class::ACTION_FIELD_KEY => [ |
|
36 | 36 | 'ru' => 'Ключ от учетной записи', |
37 | 37 | ], |
38 | - 'field_main_name_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
38 | + 'field_main_name_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
39 | 39 | 'ru' => 'Язык', |
40 | 40 | ], |
41 | - 'field_main_desc_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
41 | + 'field_main_desc_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
42 | 42 | 'ru' => 'На каком языке текст на капче', |
43 | 43 | ], |
44 | - 'field_main_name_'.$class::ACTION_FIELD_FILE => [ |
|
44 | + 'field_main_name_' . $class::ACTION_FIELD_FILE => [ |
|
45 | 45 | 'ru' => 'Картинка', |
46 | 46 | ], |
47 | - 'field_main_desc_'.$class::ACTION_FIELD_FILE => [ |
|
47 | + 'field_main_desc_' . $class::ACTION_FIELD_FILE => [ |
|
48 | 48 | 'ru' => 'Путь на файл с картинкой или ссылка на него', |
49 | 49 | ], |
50 | - 'field_main_name_'.$class::ACTION_FIELD_PHRASE => [ |
|
50 | + 'field_main_name_' . $class::ACTION_FIELD_PHRASE => [ |
|
51 | 51 | 'ru' => 'Несколько слов', |
52 | 52 | ], |
53 | - 'field_main_desc_'.$class::ACTION_FIELD_PHRASE => [ |
|
53 | + 'field_main_desc_' . $class::ACTION_FIELD_PHRASE => [ |
|
54 | 54 | 'ru' => 'Работник должен ввести текст с одним или несколькими пробелами', |
55 | 55 | ], |
56 | - 'field_main_name_'.$class::ACTION_FIELD_REGSENSE => [ |
|
56 | + 'field_main_name_' . $class::ACTION_FIELD_REGSENSE => [ |
|
57 | 57 | 'ru' => 'Регистр', |
58 | 58 | ], |
59 | - 'field_main_desc_'.$class::ACTION_FIELD_REGSENSE => [ |
|
59 | + 'field_main_desc_' . $class::ACTION_FIELD_REGSENSE => [ |
|
60 | 60 | 'ru' => 'Работник должен ввсести ответ с учетом регистра', |
61 | 61 | ], |
62 | - 'field_main_name_'.$class::ACTION_FIELD_NUMERIC => [ |
|
62 | + 'field_main_name_' . $class::ACTION_FIELD_NUMERIC => [ |
|
63 | 63 | 'ru' => 'Символы', |
64 | 64 | ], |
65 | - 'field_main_desc_'.$class::ACTION_FIELD_NUMERIC => [ |
|
65 | + 'field_main_desc_' . $class::ACTION_FIELD_NUMERIC => [ |
|
66 | 66 | 'ru' => 'Какие символы используется в капче', |
67 | 67 | ], |
68 | - 'field_main_name_'.$class::ACTION_FIELD_CALC => [ |
|
68 | + 'field_main_name_' . $class::ACTION_FIELD_CALC => [ |
|
69 | 69 | 'ru' => 'Вычисление', |
70 | 70 | ], |
71 | - 'field_main_desc_'.$class::ACTION_FIELD_CALC => [ |
|
71 | + 'field_main_desc_' . $class::ACTION_FIELD_CALC => [ |
|
72 | 72 | 'ru' => 'На капче изображенно математичекая выражение и её необходимо решить', |
73 | 73 | ], |
74 | - 'field_main_name_'.$class::ACTION_FIELD_MIN_LEN => [ |
|
74 | + 'field_main_name_' . $class::ACTION_FIELD_MIN_LEN => [ |
|
75 | 75 | 'ru' => 'Длина min', |
76 | 76 | ], |
77 | - 'field_main_desc_'.$class::ACTION_FIELD_MIN_LEN => [ |
|
77 | + 'field_main_desc_' . $class::ACTION_FIELD_MIN_LEN => [ |
|
78 | 78 | 'ru' => 'Минимальная длина капчи', |
79 | 79 | ], |
80 | - 'field_main_name_'.$class::ACTION_FIELD_MAX_LEN => [ |
|
80 | + 'field_main_name_' . $class::ACTION_FIELD_MAX_LEN => [ |
|
81 | 81 | 'ru' => 'Длина max', |
82 | 82 | ], |
83 | - 'field_main_desc_'.$class::ACTION_FIELD_MAX_LEN => [ |
|
83 | + 'field_main_desc_' . $class::ACTION_FIELD_MAX_LEN => [ |
|
84 | 84 | 'ru' => 'Максимальная длина капчи', |
85 | 85 | ], |
86 | - 'field_main_name_'.$class::ACTION_FIELD_QUESTION => [ |
|
86 | + 'field_main_name_' . $class::ACTION_FIELD_QUESTION => [ |
|
87 | 87 | 'ru' => 'Вопрос', |
88 | 88 | ], |
89 | - 'field_main_desc_'.$class::ACTION_FIELD_QUESTION => [ |
|
89 | + 'field_main_desc_' . $class::ACTION_FIELD_QUESTION => [ |
|
90 | 90 | 'ru' => 'На изображении задан вопрос, работник должен написать ответ', |
91 | 91 | ], |
92 | - 'field_main_name_'.$class::ACTION_FIELD_IS_RUSSIAN => [ |
|
92 | + 'field_main_name_' . $class::ACTION_FIELD_IS_RUSSIAN => [ |
|
93 | 93 | 'ru' => 'Кириллица', |
94 | 94 | ], |
95 | - 'field_main_desc_'.$class::ACTION_FIELD_IS_RUSSIAN => [ |
|
95 | + 'field_main_desc_' . $class::ACTION_FIELD_IS_RUSSIAN => [ |
|
96 | 96 | 'ru' => 'На изображении присутствуют русские символы', |
97 | 97 | ], |
98 | - 'field_main_name_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
98 | + 'field_main_name_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
99 | 99 | 'ru' => 'Язык', |
100 | 100 | ], |
101 | - 'field_main_desc_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
101 | + 'field_main_desc_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
102 | 102 | 'ru' => 'Символы какого языка размещенны на капче', |
103 | 103 | ], |
104 | - 'field_main_name_'.$class::ACTION_FIELD_HEADER_ACAO => [ |
|
104 | + 'field_main_name_' . $class::ACTION_FIELD_HEADER_ACAO => [ |
|
105 | 105 | 'ru' => 'Кросс-доменный', |
106 | 106 | ], |
107 | - 'field_main_desc_'.$class::ACTION_FIELD_HEADER_ACAO => [ |
|
107 | + 'field_main_desc_' . $class::ACTION_FIELD_HEADER_ACAO => [ |
|
108 | 108 | 'ru' => 'Необходимо для кросс-доменных AJAX запросов в браузерных приложениях.', |
109 | 109 | ], |
110 | - 'field_main_name_'.$class::ACTION_FIELD_INSTRUCTIONS => [ |
|
110 | + 'field_main_name_' . $class::ACTION_FIELD_INSTRUCTIONS => [ |
|
111 | 111 | 'ru' => 'Инструкция', |
112 | 112 | ], |
113 | - 'field_main_desc_'.$class::ACTION_FIELD_INSTRUCTIONS => [ |
|
113 | + 'field_main_desc_' . $class::ACTION_FIELD_INSTRUCTIONS => [ |
|
114 | 114 | 'ru' => 'Текстовая капча или инструкция для прохождения капчи.', |
115 | 115 | ], |
116 | - 'field_main_name_'.$class::ACTION_FIELD_PINGBACK => [ |
|
116 | + 'field_main_name_' . $class::ACTION_FIELD_PINGBACK => [ |
|
117 | 117 | 'ru' => 'Ответ на', |
118 | 118 | ], |
119 | - 'field_main_desc_'.$class::ACTION_FIELD_PINGBACK => [ |
|
119 | + 'field_main_desc_' . $class::ACTION_FIELD_PINGBACK => [ |
|
120 | 120 | 'ru' => 'Указание для сервера, что после распознания изображения, нужно отправить ответ на указанный адрес.', |
121 | 121 | ], |
122 | - 'field_main_name_'.$class::ACTION_FIELD_LABEL => [ |
|
122 | + 'field_main_name_' . $class::ACTION_FIELD_LABEL => [ |
|
123 | 123 | 'ru' => 'От куда', |
124 | 124 | ], |
125 | - 'field_main_desc_'.$class::ACTION_FIELD_LABEL => [ |
|
125 | + 'field_main_desc_' . $class::ACTION_FIELD_LABEL => [ |
|
126 | 126 | 'ru' => 'Пояснение от куда пришла капча ("vk", "google", "recaptcha", "yandex", "mailru", "yahoo" и т.д.).', |
127 | 127 | ], |
128 | - 'field_main_name_'.$class::ACTION_FIELD_PAGEURL => [ |
|
128 | + 'field_main_name_' . $class::ACTION_FIELD_PAGEURL => [ |
|
129 | 129 | 'ru' => 'Адрес', |
130 | 130 | ], |
131 | - 'field_main_desc_'.$class::ACTION_FIELD_PAGEURL => [ |
|
131 | + 'field_main_desc_' . $class::ACTION_FIELD_PAGEURL => [ |
|
132 | 132 | 'ru' => 'Адрес страницы на которой решается капча.', |
133 | 133 | ], |
134 | - 'field_main_name_'.$class::ACTION_FIELD_GOOGLEKEY => [ |
|
134 | + 'field_main_name_' . $class::ACTION_FIELD_GOOGLEKEY => [ |
|
135 | 135 | 'ru' => 'Google key', |
136 | 136 | ], |
137 | - 'field_main_desc_'.$class::ACTION_FIELD_GOOGLEKEY => [ |
|
137 | + 'field_main_desc_' . $class::ACTION_FIELD_GOOGLEKEY => [ |
|
138 | 138 | 'ru' => 'Ключ-индентификатор рекапчи на целевой странице. <div class="g-recaptcha" data-sitekey="ВОТ_ЭТОТ"></div>', |
139 | 139 | ], |
140 | - 'field_main_name_'.$class::ACTION_FIELD_GOOGLETOKEN => [ |
|
140 | + 'field_main_name_' . $class::ACTION_FIELD_GOOGLETOKEN => [ |
|
141 | 141 | 'ru' => 'Google token', |
142 | 142 | ], |
143 | - 'field_main_desc_'.$class::ACTION_FIELD_GOOGLETOKEN => [ |
|
143 | + 'field_main_desc_' . $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_'.$class::ACTION_FIELD_PROXYTYPE => [ |
|
146 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYTYPE => [ |
|
147 | 147 | 'ru' => 'Тип прокси', |
148 | 148 | ], |
149 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYTYPE => [ |
|
149 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYTYPE => [ |
|
150 | 150 | 'ru' => 'Тип прокси (http, socks4, ...)', |
151 | 151 | ], |
152 | - 'field_main_name_'.$class::ACTION_FIELD_PROXY => [ |
|
152 | + 'field_main_name_' . $class::ACTION_FIELD_PROXY => [ |
|
153 | 153 | 'ru' => 'Адрес прокси', |
154 | 154 | ], |
155 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXY => [ |
|
155 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXY => [ |
|
156 | 156 | 'ru' => 'IP адрес прокси ipv4/ipv6.', |
157 | 157 | ], |
158 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYPORT => [ |
|
158 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYPORT => [ |
|
159 | 159 | 'ru' => 'Порт прокси', |
160 | 160 | ], |
161 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYPORT => [ |
|
161 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYPORT => [ |
|
162 | 162 | 'ru' => 'Порт прокси.', |
163 | 163 | ], |
164 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYLOGIN => [ |
|
164 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYLOGIN => [ |
|
165 | 165 | 'ru' => 'Логин прокси', |
166 | 166 | ], |
167 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYLOGIN => [ |
|
167 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYLOGIN => [ |
|
168 | 168 | 'ru' => 'Логин от прокси-сервера.', |
169 | 169 | ], |
170 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYPASS => [ |
|
170 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYPASS => [ |
|
171 | 171 | 'ru' => 'Пароль прокси', |
172 | 172 | ], |
173 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYPASS => [ |
|
173 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYPASS => [ |
|
174 | 174 | 'ru' => 'Пароль от прокси-сервера.', |
175 | 175 | ], |
176 | - 'field_main_name_'.$class::ACTION_FIELD_USERAGENT => [ |
|
176 | + 'field_main_name_' . $class::ACTION_FIELD_USERAGENT => [ |
|
177 | 177 | 'ru' => 'User-Agent браузера', |
178 | 178 | ], |
179 | - 'field_main_desc_'.$class::ACTION_FIELD_USERAGENT => [ |
|
179 | + 'field_main_desc_' . $class::ACTION_FIELD_USERAGENT => [ |
|
180 | 180 | 'ru' => 'User-Agent браузера, используемый в эмуляции. Необходимо использовать подпись современного браузера, иначе Google будет возвращать ошибку, требуя обновить браузер.', |
181 | 181 | ], |
182 | - 'field_main_name_'.$class::ACTION_FIELD_COOKIES => [ |
|
182 | + 'field_main_name_' . $class::ACTION_FIELD_COOKIES => [ |
|
183 | 183 | 'ru' => 'Куки', |
184 | 184 | ], |
185 | - 'field_main_desc_'.$class::ACTION_FIELD_COOKIES => [ |
|
185 | + 'field_main_desc_' . $class::ACTION_FIELD_COOKIES => [ |
|
186 | 186 | 'ru' => 'Дополнительные cookies которые мы должны использовать во время взаимодействия с целевой страницей.', |
187 | 187 | ], |
188 | 188 | 'table_th_name' => [ |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function getText($name, $separator = '; ') |
321 | 321 | { |
322 | - $getResult = function ($name, $texts) { |
|
322 | + $getResult = function($name, $texts) { |
|
323 | 323 | if (is_array($name)) { |
324 | 324 | $name = implode('_', $name); |
325 | 325 | } |
@@ -348,17 +348,17 @@ discard block |
||
348 | 348 | |
349 | 349 | protected function viewInstall() |
350 | 350 | { |
351 | - $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/).".PHP_EOL; |
|
351 | + $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/)." . PHP_EOL; |
|
352 | 352 | $str .= PHP_EOL; |
353 | - $str .= "{$this->getText(['install', 'start'])}".PHP_EOL; |
|
354 | - $str .= '```'.PHP_EOL; |
|
355 | - $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"'.PHP_EOL; |
|
356 | - $str .= '```'.PHP_EOL; |
|
357 | - $str .= "{$this->getText(['install', 'add'])}".PHP_EOL; |
|
358 | - $str .= '```'.PHP_EOL; |
|
359 | - $str .= '"jumper423/decaptcha": "*"'.PHP_EOL; |
|
360 | - $str .= '```'.PHP_EOL; |
|
361 | - $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`.".PHP_EOL; |
|
353 | + $str .= "{$this->getText(['install', 'start'])}" . PHP_EOL; |
|
354 | + $str .= '```' . PHP_EOL; |
|
355 | + $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"' . PHP_EOL; |
|
356 | + $str .= '```' . PHP_EOL; |
|
357 | + $str .= "{$this->getText(['install', 'add'])}" . PHP_EOL; |
|
358 | + $str .= '```' . PHP_EOL; |
|
359 | + $str .= '"jumper423/decaptcha": "*"' . PHP_EOL; |
|
360 | + $str .= '```' . PHP_EOL; |
|
361 | + $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`." . PHP_EOL; |
|
362 | 362 | |
363 | 363 | return $str; |
364 | 364 | } |
@@ -368,12 +368,12 @@ discard block |
||
368 | 368 | $class = $this->class; |
369 | 369 | $rc = (new \ReflectionClass($class)); |
370 | 370 | |
371 | - $str = "####{$this->getText(['example', 'initialization'])}".PHP_EOL; |
|
372 | - $str .= "{$this->getText(['example', 'initialization', 'desc'])}".PHP_EOL; |
|
373 | - $str .= '```'.PHP_EOL; |
|
374 | - $str .= "use {$rc->getName()};".PHP_EOL; |
|
375 | - $str .= ''.PHP_EOL; |
|
376 | - $str .= '$captcha = new '.$rc->getShortName().'(['.PHP_EOL; |
|
371 | + $str = "####{$this->getText(['example', 'initialization'])}" . PHP_EOL; |
|
372 | + $str .= "{$this->getText(['example', 'initialization', 'desc'])}" . PHP_EOL; |
|
373 | + $str .= '```' . PHP_EOL; |
|
374 | + $str .= "use {$rc->getName()};" . PHP_EOL; |
|
375 | + $str .= '' . PHP_EOL; |
|
376 | + $str .= '$captcha = new ' . $rc->getShortName() . '([' . PHP_EOL; |
|
377 | 377 | foreach ($this->texts['constructor_data'] as $key => $val) { |
378 | 378 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
379 | 379 | if (is_string($val)) { |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | } else { |
382 | 382 | $str .= "{$val}"; |
383 | 383 | } |
384 | - $str .= ','.PHP_EOL; |
|
384 | + $str .= ',' . PHP_EOL; |
|
385 | 385 | } |
386 | - $str .= ']);'.PHP_EOL; |
|
387 | - $str .= '```'.PHP_EOL; |
|
386 | + $str .= ']);' . PHP_EOL; |
|
387 | + $str .= '```' . PHP_EOL; |
|
388 | 388 | |
389 | - $str .= "####{$this->getText(['example', 'recognize'])}".PHP_EOL; |
|
390 | - $str .= "{$this->getText(['example', 'recognize', 'desc'])}".PHP_EOL; |
|
391 | - $str .= '```'.PHP_EOL; |
|
389 | + $str .= "####{$this->getText(['example', 'recognize'])}" . PHP_EOL; |
|
390 | + $str .= "{$this->getText(['example', 'recognize', 'desc'])}" . PHP_EOL; |
|
391 | + $str .= '```' . PHP_EOL; |
|
392 | 392 | $str .= 'if ($captcha->recognize('; |
393 | 393 | if ($this->texts['recognize_file']) { |
394 | 394 | $str .= "'{$this->getText(['recognize', 'data', 'file'])}'"; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if ($this->texts['recognize_file']) { |
398 | 398 | $str .= ', '; |
399 | 399 | } |
400 | - $str .= '['.PHP_EOL; |
|
400 | + $str .= '[' . PHP_EOL; |
|
401 | 401 | foreach ($this->texts['recognize_data'] as $key => $val) { |
402 | 402 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
403 | 403 | if (is_string($val)) { |
@@ -405,46 +405,46 @@ discard block |
||
405 | 405 | } else { |
406 | 406 | $str .= "{$val}"; |
407 | 407 | } |
408 | - $str .= ','.PHP_EOL; |
|
408 | + $str .= ',' . PHP_EOL; |
|
409 | 409 | } |
410 | 410 | $str .= ']'; |
411 | 411 | } |
412 | - $str .= ')) {'.PHP_EOL; |
|
413 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
414 | - $str .= '} else {'.PHP_EOL; |
|
415 | - $str .= ' $error = $captcha->getError();'.PHP_EOL; |
|
416 | - $str .= '}'.PHP_EOL; |
|
417 | - $str .= '```'.PHP_EOL; |
|
412 | + $str .= ')) {' . PHP_EOL; |
|
413 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
414 | + $str .= '} else {' . PHP_EOL; |
|
415 | + $str .= ' $error = $captcha->getError();' . PHP_EOL; |
|
416 | + $str .= '}' . PHP_EOL; |
|
417 | + $str .= '```' . PHP_EOL; |
|
418 | 418 | |
419 | 419 | if (in_array('notTrue', get_class_methods($class))) { |
420 | - $str .= "####{$this->getText(['example', 'nottrue'])}".PHP_EOL; |
|
421 | - $str .= "{$this->getText(['example', 'nottrue', 'desc'])}".PHP_EOL; |
|
422 | - $str .= '```'.PHP_EOL; |
|
423 | - $str .= '$captcha->notTrue();'.PHP_EOL; |
|
424 | - $str .= '```'.PHP_EOL; |
|
420 | + $str .= "####{$this->getText(['example', 'nottrue'])}" . PHP_EOL; |
|
421 | + $str .= "{$this->getText(['example', 'nottrue', 'desc'])}" . PHP_EOL; |
|
422 | + $str .= '```' . PHP_EOL; |
|
423 | + $str .= '$captcha->notTrue();' . PHP_EOL; |
|
424 | + $str .= '```' . PHP_EOL; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | if (in_array('getBalance', get_class_methods($class))) { |
428 | - $str .= "####{$this->getText(['example', 'balance'])}".PHP_EOL; |
|
429 | - $str .= '```'.PHP_EOL; |
|
430 | - $str .= '$balance = $captcha->getBalance();'.PHP_EOL; |
|
431 | - $str .= '```'.PHP_EOL; |
|
428 | + $str .= "####{$this->getText(['example', 'balance'])}" . PHP_EOL; |
|
429 | + $str .= '```' . PHP_EOL; |
|
430 | + $str .= '$balance = $captcha->getBalance();' . PHP_EOL; |
|
431 | + $str .= '```' . PHP_EOL; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | if ($this->getText(['example', 'error', 'lang', 'if'])) { |
435 | - $str .= "####{$this->getText(['example', 'error', 'lang'])}".PHP_EOL; |
|
436 | - $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}".PHP_EOL; |
|
437 | - $str .= '```'.PHP_EOL; |
|
438 | - $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);'.PHP_EOL; |
|
439 | - $str .= '```'.PHP_EOL; |
|
435 | + $str .= "####{$this->getText(['example', 'error', 'lang'])}" . PHP_EOL; |
|
436 | + $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}" . PHP_EOL; |
|
437 | + $str .= '```' . PHP_EOL; |
|
438 | + $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);' . PHP_EOL; |
|
439 | + $str .= '```' . PHP_EOL; |
|
440 | 440 | } |
441 | 441 | |
442 | - $str .= "####{$this->getText(['example', 'error', 'interception'])}".PHP_EOL; |
|
443 | - $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}".PHP_EOL; |
|
444 | - $str .= '```'.PHP_EOL; |
|
445 | - $str .= '$captcha->setCauseAnError(true);'.PHP_EOL; |
|
442 | + $str .= "####{$this->getText(['example', 'error', 'interception'])}" . PHP_EOL; |
|
443 | + $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}" . PHP_EOL; |
|
444 | + $str .= '```' . PHP_EOL; |
|
445 | + $str .= '$captcha->setCauseAnError(true);' . PHP_EOL; |
|
446 | 446 | $str .= PHP_EOL; |
447 | - $str .= 'try {'.PHP_EOL; |
|
447 | + $str .= 'try {' . PHP_EOL; |
|
448 | 448 | $str .= ' $captcha->recognize('; |
449 | 449 | if ($this->texts['recognize_file']) { |
450 | 450 | $str .= "'{$this->getText(['recognize', 'data', 'file'])}'"; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | if ($this->texts['recognize_file']) { |
454 | 454 | $str .= ', '; |
455 | 455 | } |
456 | - $str .= '['.PHP_EOL; |
|
456 | + $str .= '[' . PHP_EOL; |
|
457 | 457 | foreach ($this->texts['recognize_data'] as $key => $val) { |
458 | 458 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
459 | 459 | if (is_string($val)) { |
@@ -461,16 +461,16 @@ discard block |
||
461 | 461 | } else { |
462 | 462 | $str .= "{$val}"; |
463 | 463 | } |
464 | - $str .= ','.PHP_EOL; |
|
464 | + $str .= ',' . PHP_EOL; |
|
465 | 465 | } |
466 | 466 | $str .= ' ]'; |
467 | 467 | } |
468 | - $str .= ');'.PHP_EOL; |
|
469 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
470 | - $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {'.PHP_EOL; |
|
471 | - $str .= ' ...'.PHP_EOL; |
|
472 | - $str .= '}'.PHP_EOL; |
|
473 | - $str .= '```'.PHP_EOL; |
|
468 | + $str .= ');' . PHP_EOL; |
|
469 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
470 | + $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {' . PHP_EOL; |
|
471 | + $str .= ' ...' . PHP_EOL; |
|
472 | + $str .= '}' . PHP_EOL; |
|
473 | + $str .= '```' . PHP_EOL; |
|
474 | 474 | |
475 | 475 | return $str; |
476 | 476 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | protected function viewFields() |
479 | 479 | { |
480 | 480 | $class = $this->class; |
481 | - $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; |
|
482 | - $str .= ' --- | --- | --- | --- | --- | --- | --- '.PHP_EOL; |
|
481 | + $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; |
|
482 | + $str .= ' --- | --- | --- | --- | --- | --- | --- ' . PHP_EOL; |
|
483 | 483 | foreach ($this->class->actions[$class::ACTION_RECOGNIZE][$class::ACTION_FIELDS] as $param => $setting) { |
484 | 484 | if (array_key_exists($class::ACTION_FIELDS, $setting) && is_array($setting[$class::ACTION_FIELDS])) { |
485 | 485 | foreach ($setting[$class::ACTION_FIELDS] as $param1 => $setting1) { |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | $class = $this->class; |
504 | 504 | $str = " {$this->getText(['field', 'main', 'name', $param])} |"; |
505 | 505 | $str .= " {$this->getNameConst('ACTION_FIELD_', $param)} |"; |
506 | - $str .= ' '.substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[$class::PARAM_SLUG_TYPE]), 17).' |'; |
|
507 | - $str .= ' '.(array_key_exists($class::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-').' |'; |
|
508 | - $str .= ' '.(array_key_exists($class::PARAM_SLUG_DEFAULT, $setting) ? $setting[$class::PARAM_SLUG_DEFAULT] : '').' |'; |
|
506 | + $str .= ' ' . substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[$class::PARAM_SLUG_TYPE]), 17) . ' |'; |
|
507 | + $str .= ' ' . (array_key_exists($class::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') . ' |'; |
|
508 | + $str .= ' ' . (array_key_exists($class::PARAM_SLUG_DEFAULT, $setting) ? $setting[$class::PARAM_SLUG_DEFAULT] : '') . ' |'; |
|
509 | 509 | $str .= " {$this->getText(['field', 'slug', $class::PARAM_SLUG_ENUM, $param])} |"; |
510 | 510 | $str .= " {$this->getText(['field', 'main', 'desc', $param])} |"; |
511 | 511 | $str .= PHP_EOL; |
@@ -515,9 +515,9 @@ discard block |
||
515 | 515 | |
516 | 516 | protected function viewMenu() |
517 | 517 | { |
518 | - $str = "+ [{$this->getText(['slug', 'menu', 'main'])}](../docs/README-{$this->lang}.md)".PHP_EOL; |
|
519 | - $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
|
520 | - $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}".PHP_EOL; |
|
518 | + $str = "+ [{$this->getText(['slug', 'menu', 'main'])}](../docs/README-{$this->lang}.md)" . PHP_EOL; |
|
519 | + $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')' . PHP_EOL; |
|
520 | + $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}" . PHP_EOL; |
|
521 | 521 | foreach ([ |
522 | 522 | ['slug', 'link'], |
523 | 523 | ['slug', 'service', 'desc'], |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | ['example'], |
528 | 528 | ['slug', 'fields', 'desc'], |
529 | 529 | ] as $anchor) { |
530 | - $str .= " + [{$this->getText($anchor)}](#".implode('-', explode(' ', $this->getText($anchor))).')'.PHP_EOL; |
|
530 | + $str .= " + [{$this->getText($anchor)}](#" . implode('-', explode(' ', $this->getText($anchor))) . ')' . PHP_EOL; |
|
531 | 531 | } |
532 | 532 | if ($this->getText(['menu', 'from_service'])) { |
533 | - $str .= "+ {$this->getText(['slug', 'menu', 'from_service'])}".PHP_EOL; |
|
533 | + $str .= "+ {$this->getText(['slug', 'menu', 'from_service'])}" . PHP_EOL; |
|
534 | 534 | foreach ($this->texts['menu_from_service'] as $fromServiceClass) { |
535 | 535 | $fromServiceObject = new $fromServiceClass([]); |
536 | 536 | $fromServiceObjectWiki = $fromServiceObject->getWiki($this->lang); |
537 | - $str .= " + [{$fromServiceObjectWiki->getText(['service', 'name'])}](../docs/{$fromServiceObjectWiki->getFileName()})".PHP_EOL; |
|
537 | + $str .= " + [{$fromServiceObjectWiki->getText(['service', 'name'])}](../docs/{$fromServiceObjectWiki->getFileName()})" . PHP_EOL; |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | |
@@ -556,24 +556,24 @@ discard block |
||
556 | 556 | |
557 | 557 | public function view() |
558 | 558 | { |
559 | - $str = $this->getText(['service', 'name']).PHP_EOL; |
|
560 | - $str .= '=============='.PHP_EOL; |
|
561 | - $str .= "###{$this->getText(['slug', 'menu'])}".PHP_EOL; |
|
562 | - $str .= $this->viewMenu().PHP_EOL.PHP_EOL; |
|
563 | - $str .= "###{$this->getText(['slug', 'link'])}".PHP_EOL; |
|
564 | - $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})".PHP_EOL.PHP_EOL; |
|
565 | - $str .= "###{$this->getText(['slug', 'service', 'desc'])}".PHP_EOL; |
|
566 | - $str .= "{$this->getText(['service', 'desc'])}".PHP_EOL.PHP_EOL; |
|
567 | - $str .= "###{$this->getText(['slug', 'price'])}".PHP_EOL; |
|
568 | - $str .= "{$this->getText(['recognize', 'price'])}".PHP_EOL.PHP_EOL; |
|
569 | - $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}".PHP_EOL; |
|
570 | - $str .= "{$this->getText(['recognize', 'desc'])}".PHP_EOL.PHP_EOL; |
|
571 | - $str .= "###{$this->getText(['install'])}".PHP_EOL; |
|
572 | - $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL; |
|
573 | - $str .= "###{$this->getText(['example'])}".PHP_EOL; |
|
574 | - $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL; |
|
575 | - $str .= "###{$this->getText(['slug', 'fields', 'desc'])}".PHP_EOL; |
|
576 | - $str .= $this->viewFields().PHP_EOL; |
|
559 | + $str = $this->getText(['service', 'name']) . PHP_EOL; |
|
560 | + $str .= '==============' . PHP_EOL; |
|
561 | + $str .= "###{$this->getText(['slug', 'menu'])}" . PHP_EOL; |
|
562 | + $str .= $this->viewMenu() . PHP_EOL . PHP_EOL; |
|
563 | + $str .= "###{$this->getText(['slug', 'link'])}" . PHP_EOL; |
|
564 | + $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})" . PHP_EOL . PHP_EOL; |
|
565 | + $str .= "###{$this->getText(['slug', 'service', 'desc'])}" . PHP_EOL; |
|
566 | + $str .= "{$this->getText(['service', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
567 | + $str .= "###{$this->getText(['slug', 'price'])}" . PHP_EOL; |
|
568 | + $str .= "{$this->getText(['recognize', 'price'])}" . PHP_EOL . PHP_EOL; |
|
569 | + $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}" . PHP_EOL; |
|
570 | + $str .= "{$this->getText(['recognize', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
571 | + $str .= "###{$this->getText(['install'])}" . PHP_EOL; |
|
572 | + $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL; |
|
573 | + $str .= "###{$this->getText(['example'])}" . PHP_EOL; |
|
574 | + $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL; |
|
575 | + $str .= "###{$this->getText(['slug', 'fields', 'desc'])}" . PHP_EOL; |
|
576 | + $str .= $this->viewFields() . PHP_EOL; |
|
577 | 577 | |
578 | 578 | return $str; |
579 | 579 | } |
@@ -585,11 +585,11 @@ discard block |
||
585 | 585 | } |
586 | 586 | $class = $this->class; |
587 | 587 | |
588 | - return (new \ReflectionClass($class))->getShortName().'-'.$lang.'.md'; |
|
588 | + return (new \ReflectionClass($class))->getShortName() . '-' . $lang . '.md'; |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | public function save() |
592 | 592 | { |
593 | - file_put_contents(__DIR__.'/../../docs/'.$this->getFileName(), $this->view()); |
|
593 | + file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName(), $this->view()); |
|
594 | 594 | } |
595 | 595 | } |
@@ -119,12 +119,12 @@ |
||
119 | 119 | { |
120 | 120 | $str = "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')' . PHP_EOL; |
121 | 121 | foreach ([ |
122 | - ['slug', 'menu', 'desc'], |
|
123 | - ['slug', 'menu', 'features'], |
|
124 | - ['slug', 'menu', 'services'], |
|
125 | - ['install'], |
|
126 | - ['example'], |
|
127 | - ] as $anchor) { |
|
122 | + ['slug', 'menu', 'desc'], |
|
123 | + ['slug', 'menu', 'features'], |
|
124 | + ['slug', 'menu', 'services'], |
|
125 | + ['install'], |
|
126 | + ['example'], |
|
127 | + ] as $anchor) { |
|
128 | 128 | $str .= "+ [{$this->getText($anchor)}](#" . implode('-', explode(' ', $this->getText($anchor))) . ')' . PHP_EOL; |
129 | 129 | } |
130 | 130 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getText($name, $separator = '; ') |
89 | 89 | { |
90 | - $getResult = function ($name, $texts) { |
|
90 | + $getResult = function($name, $texts) { |
|
91 | 91 | if (is_array($name)) { |
92 | 92 | $name = implode('_', $name); |
93 | 93 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | protected function viewMenu($master = '') |
118 | 118 | { |
119 | - $str = "+ [{$this->getText(['slug', 'menu', 'another'])}](../{$master}docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
|
119 | + $str = "+ [{$this->getText(['slug', 'menu', 'another'])}](../{$master}docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')' . PHP_EOL; |
|
120 | 120 | foreach ([ |
121 | 121 | ['slug', 'menu', 'desc'], |
122 | 122 | ['slug', 'menu', 'features'], |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ['install'], |
125 | 125 | ['example'], |
126 | 126 | ] as $anchor) { |
127 | - $str .= "+ [{$this->getText($anchor)}](#".implode('-', explode(' ', $this->getText($anchor))).')'.PHP_EOL; |
|
127 | + $str .= "+ [{$this->getText($anchor)}](#" . implode('-', explode(' ', $this->getText($anchor))) . ')' . PHP_EOL; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return $str; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | $tt[$class->getWiki($this->lang)->getFileName()] = true; |
142 | 142 | $fromServiceObjectWiki = $class->getWiki($this->lang); |
143 | - $str .= "+ [{$fromServiceObjectWiki->getText(['service', 'name'])}](../{$master}docs/{$fromServiceObjectWiki->getFileName()})".PHP_EOL; |
|
143 | + $str .= "+ [{$fromServiceObjectWiki->getText(['service', 'name'])}](../{$master}docs/{$fromServiceObjectWiki->getFileName()})" . PHP_EOL; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $str; |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | |
149 | 149 | public function view($master = '') |
150 | 150 | { |
151 | - $str = $this->viewHeader().PHP_EOL; |
|
151 | + $str = $this->viewHeader() . PHP_EOL; |
|
152 | 152 | |
153 | - $str .= "###{$this->getText(['slug', 'menu'])}".PHP_EOL; |
|
154 | - $str .= $this->viewMenu($master).PHP_EOL.PHP_EOL; |
|
153 | + $str .= "###{$this->getText(['slug', 'menu'])}" . PHP_EOL; |
|
154 | + $str .= $this->viewMenu($master) . PHP_EOL . PHP_EOL; |
|
155 | 155 | |
156 | - $str .= "###{$this->getText(['slug', 'menu', 'desc'])}".PHP_EOL; |
|
157 | - $str .= $this->getText(['readme', 'main', 'desc']).PHP_EOL.PHP_EOL; |
|
156 | + $str .= "###{$this->getText(['slug', 'menu', 'desc'])}" . PHP_EOL; |
|
157 | + $str .= $this->getText(['readme', 'main', 'desc']) . PHP_EOL . PHP_EOL; |
|
158 | 158 | |
159 | - $str .= "###{$this->getText(['slug', 'menu', 'features'])}".PHP_EOL; |
|
160 | - $str .= $this->getText(['readme', 'main', 'features'], PHP_EOL).PHP_EOL.PHP_EOL; |
|
159 | + $str .= "###{$this->getText(['slug', 'menu', 'features'])}" . PHP_EOL; |
|
160 | + $str .= $this->getText(['readme', 'main', 'features'], PHP_EOL) . PHP_EOL . PHP_EOL; |
|
161 | 161 | |
162 | - $str .= "###{$this->getText(['slug', 'menu', 'services'])}".PHP_EOL; |
|
163 | - $str .= "{$this->getText(['readme', 'main', 'services'])}".PHP_EOL.PHP_EOL; |
|
164 | - $str .= "{$this->viewServices($master)}".PHP_EOL.PHP_EOL; |
|
162 | + $str .= "###{$this->getText(['slug', 'menu', 'services'])}" . PHP_EOL; |
|
163 | + $str .= "{$this->getText(['readme', 'main', 'services'])}" . PHP_EOL . PHP_EOL; |
|
164 | + $str .= "{$this->viewServices($master)}" . PHP_EOL . PHP_EOL; |
|
165 | 165 | |
166 | - $str .= "###{$this->getText(['install'])}".PHP_EOL; |
|
167 | - $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL; |
|
168 | - $str .= "###{$this->getText(['example'])}".PHP_EOL; |
|
169 | - $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL; |
|
166 | + $str .= "###{$this->getText(['install'])}" . PHP_EOL; |
|
167 | + $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL; |
|
168 | + $str .= "###{$this->getText(['example'])}" . PHP_EOL; |
|
169 | + $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL; |
|
170 | 170 | |
171 | 171 | return $str; |
172 | 172 | } |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | $lang = $this->lang; |
178 | 178 | } |
179 | 179 | |
180 | - return 'README-'.$lang.'.md'; |
|
180 | + return 'README-' . $lang . '.md'; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | public function save() |
184 | 184 | { |
185 | - file_put_contents(__DIR__.'/../../docs/'.$this->getFileName(), $this->view()); |
|
186 | - file_put_contents(__DIR__.'/../../README.md', $this->view('master/')); |
|
185 | + file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName(), $this->view()); |
|
186 | + file_put_contents(__DIR__ . '/../../README.md', $this->view('master/')); |
|
187 | 187 | } |
188 | 188 | } |