@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | parent::__construct('select'); |
| 37 | 37 | $this->list = $list; |
| 38 | 38 | $this->setAttribute('name', $name); |
| 39 | - $this->setAttribute('value', (array)$value); |
|
| 39 | + $this->setAttribute('value', (array) $value); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function formSelect() |
| 75 | 75 | { |
| 76 | - $selectedValue = (array)$this->get('value'); |
|
| 76 | + $selectedValue = (array) $this->get('value'); |
|
| 77 | 77 | $this->setAttribute('value', false); |
| 78 | 78 | $html = $this->formOptions($this->list, $selectedValue, $this->head); |
| 79 | 79 | if ($html) { |
| 80 | - $this->contents($html . "\n"); |
|
| 80 | + $this->contents($html."\n"); |
|
| 81 | 81 | $html = TagToString::format($this); |
| 82 | 82 | } |
| 83 | 83 | return $html; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $html .= "\n <option value=\"\">{$head}</option>"; |
| 97 | 97 | } |
| 98 | 98 | foreach ($list as $value => $label) { |
| 99 | - if (in_array((string)$value, $selectedValue)) { |
|
| 99 | + if (in_array((string) $value, $selectedValue)) { |
|
| 100 | 100 | $html .= "\n <option value=\"{$value}\" selected>{$label}</option>"; |
| 101 | 101 | } else { |
| 102 | 102 | $html .= "\n <option value=\"{$value}\">{$label}</option>"; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $html = TagToString::format($this); |
| 44 | 44 | if ($this->label) { |
| 45 | - $html = $this->labelHtml($html . ' ' . $this->label); |
|
| 45 | + $html = $this->labelHtml($html.' '.$this->label); |
|
| 46 | 46 | } |
| 47 | 47 | return $html; |
| 48 | 48 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | $html = TagToString::format($this); |
| 87 | 87 | if (!is_null($this->_method)) { |
| 88 | - $html .= "\n<input type=\"hidden\" name=\"{$this->_token_name}\" value=\"" . $this->_method . "\" />"; |
|
| 88 | + $html .= "\n<input type=\"hidden\" name=\"{$this->_token_name}\" value=\"".$this->_method."\" />"; |
|
| 89 | 89 | } |
| 90 | 90 | return $html; |
| 91 | 91 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->multiple = $multiple; |
| 29 | 29 | $name = $this->get('name'); |
| 30 | - $this->setAttribute('name', $name . '[]'); |
|
| 30 | + $this->setAttribute('name', $name.'[]'); |
|
| 31 | 31 | return $this; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $id = $this->getName(); |
| 69 | 69 | $id = str_replace(['[', ']', '_'], '-', $id); |
| 70 | 70 | if (in_array($this->get('type'), ['radio', 'checkbox'])) { |
| 71 | - $id .= '-' . $this->get('value'); |
|
| 71 | + $id .= '-'.$this->get('value'); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | $this->setAttribute('id', $id); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | if ((is_array($data))) { |
| 35 | 35 | return true; |
| 36 | 36 | } |
| 37 | - if (is_object($data) && $data instanceof ArrayAccess) { |
|
| 37 | + if (is_object($data) && $data instanceof ArrayAccess) { |
|
| 38 | 38 | return true; |
| 39 | 39 | } |
| 40 | 40 | return false; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function getArray($data, $key, $default = null) |
| 50 | 50 | { |
| 51 | - return array_key_exists($key, $data) ? $data[$key]: $default; |
|
| 51 | + return array_key_exists($key, $data) ? $data[$key] : $default; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public static function getObj($data, $key, $default = null) |
| 61 | 61 | { |
| 62 | - $method = 'get' . $key; |
|
| 62 | + $method = 'get'.$key; |
|
| 63 | 63 | if (method_exists($data, $method)) { |
| 64 | 64 | return $data->$method(); |
| 65 | 65 | } |
| 66 | - $method = 'get' . str_replace('_', '', $key); |
|
| 66 | + $method = 'get'.str_replace('_', '', $key); |
|
| 67 | 67 | if (method_exists($data, $method)) { |
| 68 | 68 | return $data->$method(); |
| 69 | 69 | } |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | if (!is_object($data)) { |
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | - if (method_exists($data, 'get' . $key)) { |
|
| 93 | + if (method_exists($data, 'get'.$key)) { |
|
| 94 | 94 | return true; |
| 95 | 95 | } |
| 96 | - if (method_exists($data, 'get' . str_replace('_', '', $key))) { |
|
| 96 | + if (method_exists($data, 'get'.str_replace('_', '', $key))) { |
|
| 97 | 97 | return true; |
| 98 | 98 | } |
| 99 | 99 | if (isset($data->$key)) { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $start ?: date('Y') - 1, |
| 18 | 18 | $end ?: date('Y') + 1, |
| 19 | 19 | $step, |
| 20 | - function ($year) { |
|
| 20 | + function($year) { |
|
| 21 | 21 | return sprintf('%04d', $year); |
| 22 | 22 | }); |
| 23 | 23 | } |
@@ -37,15 +37,15 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function formatJpnGenGou() |
| 39 | 39 | { |
| 40 | - $genGou = [ // until => genGou name |
|
| 40 | + $genGou = [// until => genGou name |
|
| 41 | 41 | '1868' => false, // end of genGou, specified by false. |
| 42 | 42 | '1911' => '明治', |
| 43 | 43 | '1925' => '大正', |
| 44 | 44 | '1988' => '昭和', |
| 45 | 45 | '9999' => '平成', // so far... |
| 46 | 46 | ]; |
| 47 | - return function ($year) use ($genGou) { |
|
| 48 | - $year = (int)$year; |
|
| 47 | + return function($year) use ($genGou) { |
|
| 48 | + $year = (int) $year; |
|
| 49 | 49 | $start = 0; |
| 50 | 50 | /** @var string|bool $gou */ |
| 51 | 51 | foreach ($genGou as $ends => $gou) { |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | if ($year == 1) { |
| 58 | 58 | $year = '元'; |
| 59 | 59 | } |
| 60 | - return $gou . $year . '年'; |
|
| 60 | + return $gou.$year.'年'; |
|
| 61 | 61 | } |
| 62 | 62 | $start = $ends; |
| 63 | 63 | } |
| 64 | - return '西暦' . $year . '年'; |
|
| 64 | + return '西暦'.$year.'年'; |
|
| 65 | 65 | }; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function getReversed() |
| 55 | 55 | { |
| 56 | 56 | $reverse = []; |
| 57 | - for($idx = count($this->breads) - 1; $idx >= 0; $idx--) { |
|
| 57 | + for ($idx = count($this->breads) - 1; $idx >= 0; $idx--) { |
|
| 58 | 58 | $reverse[] = $this->breads[$idx]; |
| 59 | 59 | } |
| 60 | 60 | return $reverse; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $bread = $this->getReversed(); |
| 79 | 79 | |
| 80 | - foreach($bread as $row) { |
|
| 80 | + foreach ($bread as $row) { |
|
| 81 | 81 | if (isset($row[self::LAST]) && $row[self::LAST]) { |
| 82 | 82 | $this->isLast = true; |
| 83 | 83 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $html = TagToString::format($this); |
| 44 | 44 | if ($this->label) { |
| 45 | - $html = $this->labelHtml($html . ' ' . $this->label); |
|
| 45 | + $html = $this->labelHtml($html.' '.$this->label); |
|
| 46 | 46 | } |
| 47 | 47 | return $html; |
| 48 | 48 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function onlyOne() |
| 71 | 71 | { |
| 72 | - $serious = $this->findMostSerious(); |
|
| 72 | + $serious = $this->findMostSerious(); |
|
| 73 | 73 | if (!empty($serious)) { |
| 74 | 74 | return $this->show($serious); |
| 75 | 75 | } |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | self::ALERT => 2, |
| 87 | 87 | self::MESSAGE => 1, |
| 88 | 88 | ]; |
| 89 | - $serious = array_reduce( |
|
| 89 | + $serious = array_reduce( |
|
| 90 | 90 | $this->messages, |
| 91 | - function ($carry, $msg) use ($msgScores) { |
|
| 91 | + function($carry, $msg) use ($msgScores) { |
|
| 92 | 92 | $myScore = $msgScores[$msg['type']]; |
| 93 | 93 | $msg['score'] = $myScore; |
| 94 | 94 | return $myScore > $carry['score'] ? $msg : $carry; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function getIterator() |
| 121 | 121 | { |
| 122 | - foreach($this->messages as $message) { |
|
| 122 | + foreach ($this->messages as $message) { |
|
| 123 | 123 | yield $message['type'] => $message['message']; |
| 124 | 124 | } |
| 125 | 125 | } |