| @@ 320-347 (lines=28) @@ | ||
| 317 | * |
|
| 318 | * @return string|array |
|
| 319 | */ |
|
| 320 | public function getText($name, $separator = '; ') |
|
| 321 | { |
|
| 322 | $getResult = function ($name, $texts) { |
|
| 323 | if (is_array($name)) { |
|
| 324 | $name = implode('_', $name); |
|
| 325 | } |
|
| 326 | if (!isset($texts[$name])) { |
|
| 327 | return null; |
|
| 328 | } |
|
| 329 | if (is_array($texts[$name])) { |
|
| 330 | if (isset($texts[$name][$this->lang])) { |
|
| 331 | return $texts[$name][$this->lang]; |
|
| 332 | } |
|
| 333 | ||
| 334 | return array_values($texts[$name])[0]; |
|
| 335 | } |
|
| 336 | ||
| 337 | return $texts[$name]; |
|
| 338 | }; |
|
| 339 | $result = $getResult($name, $this->texts); |
|
| 340 | if (is_array($result)) { |
|
| 341 | if ($separator) { |
|
| 342 | $result = implode($separator, $result); |
|
| 343 | } |
|
| 344 | } |
|
| 345 | ||
| 346 | return $result; |
|
| 347 | } |
|
| 348 | ||
| 349 | protected function viewInstall() |
|
| 350 | { |
|
| @@ 88-115 (lines=28) @@ | ||
| 85 | * |
|
| 86 | * @return string|array |
|
| 87 | */ |
|
| 88 | public function getText($name, $separator = '; ') |
|
| 89 | { |
|
| 90 | $getResult = function ($name, $texts) { |
|
| 91 | if (is_array($name)) { |
|
| 92 | $name = implode('_', $name); |
|
| 93 | } |
|
| 94 | if (!isset($texts[$name])) { |
|
| 95 | return null; |
|
| 96 | } |
|
| 97 | if (is_array($texts[$name])) { |
|
| 98 | if (isset($texts[$name][$this->lang])) { |
|
| 99 | return $texts[$name][$this->lang]; |
|
| 100 | } |
|
| 101 | ||
| 102 | return array_values($texts[$name])[0]; |
|
| 103 | } |
|
| 104 | ||
| 105 | return $texts[$name]; |
|
| 106 | }; |
|
| 107 | $result = $getResult($name, $this->texts); |
|
| 108 | if (is_array($result)) { |
|
| 109 | if ($separator) { |
|
| 110 | $result = implode($separator, $result); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | return $result; |
|
| 115 | } |
|
| 116 | ||
| 117 | ||
| 118 | protected function viewMenu() |
|