Skip to content

Commit

Permalink
Improve ternary CS
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Apr 20, 2024
1 parent c98d6e4 commit 8c74725
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/ExtensionInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini
$package_dir = $this->getInstallPath($target);

// restore persistent files
$persistent_files = !empty($extra['roundcube']['persistent-files']) ? $extra['roundcube']['persistent-files'] : ['config.inc.php'];
$persistent_files = !empty($extra['roundcube']['persistent-files'])
? $extra['roundcube']['persistent-files']
: ['config.inc.php'];
foreach ($persistent_files as $file) {
$path = $temp_dir . \DIRECTORY_SEPARATOR . $file;
if (is_readable($path)) {
Expand Down
8 changes: 6 additions & 2 deletions src/PluginInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ protected function confirmInstall($package_name)

protected function getConfig($package_name, $config, $add)
{
$cur_config = !empty($config['plugins']) ? ((array) $config['plugins']) : [];
$cur_config = !empty($config['plugins'])
? ((array) $config['plugins'])
: [];
$new_config = $cur_config;

if ($add && !in_array($package_name, $new_config, true)) {
Expand All @@ -36,7 +38,9 @@ protected function getConfig($package_name, $config, $add)
}

if ($new_config !== $cur_config) {
$config_val = count($new_config) > 0 ? "[\n\t'" . implode("',\n\t'", $new_config) . "',\n];" : '[];';
$config_val = count($new_config) > 0
? "[\n\t'" . implode("',\n\t'", $new_config) . "',\n];"
: '[];';
$result = ['plugins', $config_val];
} else {
$result = false;
Expand Down
8 changes: 6 additions & 2 deletions src/SkinInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ protected function confirmInstall($package_name)

protected function getConfig($package_name, $config, $add)
{
$cur_config = !empty($config['skin']) ? $config['skin'] : null;
$cur_config = !empty($config['skin'])
? $config['skin']
: null;
$new_config = $cur_config;

if ($add && $new_config !== $package_name) {
Expand All @@ -36,7 +38,9 @@ protected function getConfig($package_name, $config, $add)
}

if ($new_config !== $cur_config) {
$config_val = !empty($new_config) ? "'{$new_config}';" : null;
$config_val = !empty($new_config)
? "'{$new_config}';"
: null;
$result = ['skin', $config_val];
} else {
$result = false;
Expand Down

0 comments on commit 8c74725

Please sign in to comment.