@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @inheritdoc |
23 | 23 | */ |
24 | - public function init() |
|
24 | + public function init () |
|
25 | 25 | { |
26 | 26 | parent::init(); |
27 | 27 | if ($this->message === null) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | - protected function makeRegex(): string |
|
32 | + protected function makeRegex (): string |
|
33 | 33 | { |
34 | 34 | // Hiragana range: U+3041(ぁ)..U+309F(ゟ:より) |
35 | 35 | return $this->acceptSpace ? '/^[ぁ-ゟー [:space:]]*$/u' : '/^[ぁ-ゟー]*$/u'; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @inheritdoc |
35 | 35 | * @return void |
36 | 36 | */ |
37 | - public function init() |
|
37 | + public function init () |
|
38 | 38 | { |
39 | 39 | if ($this->charset === null) { |
40 | 40 | $this->charset = Yii::$app->charset; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @inheritdoc |
29 | 29 | */ |
30 | - public function init() |
|
30 | + public function init () |
|
31 | 31 | { |
32 | 32 | parent::init(); |
33 | 33 | if ($this->message === null) { |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - protected function makeRegex(): string |
|
38 | + protected function makeRegex (): string |
|
39 | 39 | { |
40 | - return '/^[' . |
|
41 | - '0-9A-Z' . |
|
42 | - 'アイウエオカキクケコサシスセソタチツテトナニヌネノ' . |
|
43 | - 'ハヒフヘホマミムメモヤユヨラリルレロワヲン゙゚' . |
|
44 | - ',.「」()\-\/\x5c\x20' . |
|
40 | + return '/^['. |
|
41 | + '0-9A-Z'. |
|
42 | + 'アイウエオカキクケコサシスセソタチツテトナニヌネノ'. |
|
43 | + 'ハヒフヘホマミムメモヤユヨラリルレロワヲン゙゚'. |
|
44 | + ',.「」()\-\/\x5c\x20'. |
|
45 | 45 | ']+$/u'; |
46 | 46 | } |
47 | 47 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @inheritdoc |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - public function init() |
|
32 | + public function init () |
|
33 | 33 | { |
34 | 34 | $this->filter = function (string $value): string { |
35 | 35 | if (strpos($value, '/') === false) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | parent::init(); |
56 | 56 | } |
57 | 57 | |
58 | - protected static function idnToAscii(string $value): string |
|
58 | + protected static function idnToAscii (string $value): string |
|
59 | 59 | { |
60 | 60 | return (string)idn_to_ascii($value, 0, INTL_IDNA_VARIANT_UTS46); |
61 | 61 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @inheritdoc |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function init() |
|
36 | + public function init () |
|
37 | 37 | { |
38 | 38 | parent::init(); |
39 | 39 | if ($this->charset === null) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @inheritdoc |
46 | 46 | * @return void |
47 | 47 | */ |
48 | - public function validateAttribute($model, $attribute) |
|
48 | + public function validateAttribute ($model, $attribute) |
|
49 | 49 | { |
50 | 50 | if (!$this->isValid($model->$attribute)) { |
51 | 51 | $this->addError($model, $attribute, (string)$this->message); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @inheritdoc |
57 | 57 | * @return array{string, array}|null |
58 | 58 | */ |
59 | - protected function validateValue($value) |
|
59 | + protected function validateValue ($value) |
|
60 | 60 | { |
61 | 61 | if (!$this->isValid($value)) { |
62 | 62 | return [(string)$this->message, []]; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return null; |
66 | 66 | } |
67 | 67 | |
68 | - protected function isValid(mixed $value): bool |
|
68 | + protected function isValid (mixed $value): bool |
|
69 | 69 | { |
70 | 70 | if (!is_string($value)) { |
71 | 71 | return false; |
@@ -77,5 +77,5 @@ discard block |
||
77 | 77 | ); |
78 | 78 | } |
79 | 79 | |
80 | - abstract protected function makeRegex(): string; |
|
80 | + abstract protected function makeRegex (): string; |
|
81 | 81 | } |
@@ -26,12 +26,12 @@ |
||
26 | 26 | * |
27 | 27 | * @param $className string FQCN of Caller |
28 | 28 | */ |
29 | - public static function make(string $className): string |
|
29 | + public static function make (string $className): string |
|
30 | 30 | { |
31 | 31 | $className = preg_replace('/^.+\\\\(?=[^\\\\])/', '', $className); |
32 | 32 | $parts = []; |
33 | - $parts[] = $className . '(+http://bit.ly/18571qW)'; |
|
34 | - $parts[] = 'PHP/' . PHP_VERSION; |
|
33 | + $parts[] = $className.'(+http://bit.ly/18571qW)'; |
|
34 | + $parts[] = 'PHP/'.PHP_VERSION; |
|
35 | 35 | return implode(' ', $parts); |
36 | 36 | } |
37 | 37 | } |
@@ -19,9 +19,9 @@ |
||
19 | 19 | /** |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function bootstrap($app) |
|
22 | + public function bootstrap ($app) |
|
23 | 23 | { |
24 | - Yii::setAlias('@jp3ckivalidatormessages', __DIR__ . '/../../messages'); |
|
24 | + Yii::setAlias('@jp3ckivalidatormessages', __DIR__.'/../../messages'); |
|
25 | 25 | $i18n = $app->i18n; |
26 | 26 | if (!isset($i18n->translations['jp3ckivalidator'])) { |
27 | 27 | $i18n->translations['jp3ckivalidator'] = [ |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @inheritdoc |
33 | 33 | * @return void |
34 | 34 | */ |
35 | - public function init() |
|
35 | + public function init () |
|
36 | 36 | { |
37 | 37 | parent::init(); |
38 | 38 | if ($this->message === null) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @inheritdoc |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function validateAttribute($model, $attribute) |
|
51 | + public function validateAttribute ($model, $attribute) |
|
52 | 52 | { |
53 | 53 | $params = [ |
54 | 54 | 'secret' => (string)$this->secret, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * @param array<string, string> $params |
68 | 68 | */ |
69 | - private function verify(array $params): bool |
|
69 | + private function verify (array $params): bool |
|
70 | 70 | { |
71 | 71 | try { |
72 | 72 | $client = Yii::createObject([ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @inheritdoc |
25 | 25 | * @return void |
26 | 26 | */ |
27 | - public function init() |
|
27 | + public function init () |
|
28 | 28 | { |
29 | 29 | parent::init(); |
30 | 30 | if ($this->pattern === null) { |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | * |
38 | 38 | * import from http://www.din.or.jp/~ohzaki/perl.htm#httpURL |
39 | 39 | */ |
40 | - private function makeUrlRegex(): string |
|
40 | + private function makeUrlRegex (): string |
|
41 | 41 | { |
42 | 42 | $digit = '[0-9]'; |
43 | 43 | $alpha = '[a-zA-Z]'; |
44 | 44 | $alnum = '[a-zA-Z0-9]'; |
45 | 45 | $hex = '[0-9A-Fa-f]'; |
46 | 46 | $escaped = "%{$hex}{$hex}"; |
47 | - $uric = '(?:[-_.!~*\'()a-zA-Z0-9;/?:@&=+$,]' . "|{$escaped})"; |
|
47 | + $uric = '(?:[-_.!~*\'()a-zA-Z0-9;/?:@&=+$,]'."|{$escaped})"; |
|
48 | 48 | $fragment = "{$uric}*"; |
49 | 49 | $query = "{$uric}*"; |
50 | - $pchar = '(?:[-_.!~*\'()a-zA-Z0-9:@&=+$,]' . "|{$escaped})"; |
|
50 | + $pchar = '(?:[-_.!~*\'()a-zA-Z0-9:@&=+$,]'."|{$escaped})"; |
|
51 | 51 | $param = "{$pchar}*"; |
52 | 52 | $segment = "{$pchar}*(?:;{$param})*"; |
53 | 53 | $pathSegments = "{$segment}(?:/{$segment})*"; |
54 | 54 | $absPath = "/{$pathSegments}"; |
55 | 55 | $port = "{$digit}*"; |
56 | 56 | $ipv4Address = "{$digit}+\\.{$digit}+\\.{$digit}+\\.{$digit}+"; |
57 | - $topLabel = "{$alpha}(?:" . '[-a-zA-Z0-9]*' . "{$alnum})?"; |
|
58 | - $domainLabel = "{$alnum}(?:" . '[-a-zA-Z0-9]*' . "{$alnum})?"; |
|
57 | + $topLabel = "{$alpha}(?:".'[-a-zA-Z0-9]*'."{$alnum})?"; |
|
58 | + $domainLabel = "{$alnum}(?:".'[-a-zA-Z0-9]*'."{$alnum})?"; |
|
59 | 59 | $hostName = "(?:{$domainLabel}\\.)*{$topLabel}\\.?"; |
60 | 60 | $host = "(?:{$hostName}|{$ipv4Address})"; |
61 | 61 | $hostPort = "{$host}(?::{$port})?"; |
62 | - $userInfo = '(?:[-_.!~*\'()a-zA-Z0-9;:&=+$,]|' . "{$escaped})*"; |
|
62 | + $userInfo = '(?:[-_.!~*\'()a-zA-Z0-9;:&=+$,]|'."{$escaped})*"; |
|
63 | 63 | $server = "(?:{$userInfo}\@)?{$hostPort}"; |
64 | 64 | $authority = "{$server}"; |
65 | 65 | $scheme = '{schemes}'; |