diff --git a/administrator/components/com_admin/src/Model/SysinfoModel.php b/administrator/components/com_admin/src/Model/SysinfoModel.php index 52c7fc3720f40..8ee0519c37f8d 100644 --- a/administrator/components/com_admin/src/Model/SysinfoModel.php +++ b/administrator/components/com_admin/src/Model/SysinfoModel.php @@ -32,7 +32,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $php_settings = array(); + protected $php_settings = []; /** * Config values @@ -40,7 +40,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $config = array(); + protected $config = []; /** * Some system values @@ -48,7 +48,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $info = array(); + protected $info = []; /** * PHP info @@ -74,8 +74,8 @@ class SysinfoModel extends BaseDatabaseModel * * @since 3.5 */ - protected $privateSettings = array( - 'phpInfoArray' => array( + protected $privateSettings = [ + 'phpInfoArray' => [ 'CONTEXT_DOCUMENT_ROOT', 'Cookie', 'DOCUMENT_ROOT', @@ -111,8 +111,8 @@ class SysinfoModel extends BaseDatabaseModel 'upload_tmp_dir', 'User/Group', 'open_basedir', - ), - 'other' => array( + ], + 'other' => [ 'db', 'dbprefix', 'fromname', @@ -137,8 +137,8 @@ class SysinfoModel extends BaseDatabaseModel 'smtphost', 'tmp_path', 'open_basedir', - ) - ); + ] + ]; /** * System values that can be "safely" shared @@ -155,7 +155,7 @@ class SysinfoModel extends BaseDatabaseModel * @var array * @since 1.6 */ - protected $directories = array(); + protected $directories = []; /** * The current editor. @@ -175,7 +175,7 @@ class SysinfoModel extends BaseDatabaseModel * * @since 3.5 */ - protected function cleanPrivateData($dataArray, $dataType = 'other') + protected function cleanPrivateData(array $dataArray, string $dataType = 'other'): array { $dataType = isset($this->privateSettings[$dataType]) ? $dataType : 'other'; @@ -188,12 +188,12 @@ protected function cleanPrivateData($dataArray, $dataType = 'other') foreach ($dataArray as $section => $values) { - if (is_array($values)) + if (\is_array($values)) { $dataArray[$section] = $this->cleanPrivateData($values, $dataType); } - if (in_array($section, $privateSettings, true)) + if (\in_array($section, $privateSettings, true)) { $dataArray[$section] = $this->cleanSectionPrivateData($values); } @@ -207,13 +207,13 @@ protected function cleanPrivateData($dataArray, $dataType = 'other') * * @param mixed $sectionValues Section data * - * @return mixed + * @return string|array * * @since 3.5 */ protected function cleanSectionPrivateData($sectionValues) { - if (!is_array($sectionValues)) + if (!\is_array($sectionValues)) { if (strstr($sectionValues, JPATH_ROOT)) { @@ -238,14 +238,14 @@ protected function cleanSectionPrivateData($sectionValues) * * @since 1.6 */ - public function &getPhpSettings() + public function &getPhpSettings(): array { if (!empty($this->php_settings)) { return $this->php_settings; } - $this->php_settings = array( + $this->php_settings = [ 'memory_limit' => ini_get('memory_limit'), 'upload_max_filesize' => ini_get('upload_max_filesize'), 'post_max_size' => ini_get('post_max_size'), @@ -262,8 +262,9 @@ public function &getPhpSettings() 'zip' => function_exists('zip_open') && function_exists('zip_read'), 'mbstring' => extension_loaded('mbstring'), 'iconv' => function_exists('iconv'), + 'intl' => function_exists('transliterator_transliterate'), 'max_input_vars' => ini_get('max_input_vars'), - ); + ]; return $this->php_settings; } @@ -275,7 +276,7 @@ public function &getPhpSettings() * * @since 1.6 */ - public function &getConfig() + public function &getConfig(): array { if (!empty($this->config)) { @@ -284,11 +285,11 @@ public function &getConfig() $registry = new Registry(new \JConfig); $this->config = $registry->toArray(); - $hidden = array( + $hidden = [ 'host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass', 'redis_server_auth', 'session_redis_server_auth', 'proxy_user', 'proxy_pass', 'secret' - ); + ]; foreach ($hidden as $key) { @@ -305,7 +306,7 @@ public function &getConfig() * * @since 1.6 */ - public function &getInfo() + public function &getInfo(): array { if (!empty($this->info)) { @@ -314,7 +315,7 @@ public function &getInfo() $db = $this->getDbo(); - $this->info = array( + $this->info = [ 'php' => php_uname(), 'dbserver' => $db->getServerType(), 'dbversion' => $db->getVersion(), @@ -327,7 +328,7 @@ public function &getInfo() 'sapi_name' => PHP_SAPI, 'version' => (new Version)->getLongVersion(), 'useragent' => $_SERVER['HTTP_USER_AGENT'] ?? '', - ); + ]; return $this->info; } @@ -339,9 +340,9 @@ public function &getInfo() * * @since 3.4.1 */ - public function phpinfoEnabled() + public function phpinfoEnabled(): bool { - return !in_array('phpinfo', explode(',', ini_get('disable_functions'))); + return !\in_array('phpinfo', explode(',', ini_get('disable_functions'))); } /** @@ -354,7 +355,7 @@ public function phpinfoEnabled() * * @since 3.5 */ - public function getSafeData($dataType, $public = true) + public function getSafeData(string $dataType, bool $public = true): array { if (isset($this->safeData[$dataType])) { @@ -365,7 +366,7 @@ public function getSafeData($dataType, $public = true) if (!method_exists($this, $methodName)) { - return array(); + return []; } $data = $this->$methodName($public); @@ -382,7 +383,7 @@ public function getSafeData($dataType, $public = true) * * @since 1.6 */ - public function &getPHPInfo() + public function &getPHPInfo(): string { if (!$this->phpinfoEnabled()) { @@ -406,7 +407,7 @@ public function &getPHPInfo() $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); $output = preg_replace('#