From 8257ca40c19fbd2de6393b0ee664bece180aaa79 Mon Sep 17 00:00:00 2001 From: Gaetan Date: Sat, 24 Oct 2020 20:44:35 +0200 Subject: [PATCH] refactor(installer): simplify getBaseInstallationPath function --- src/ThemeInstaller.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ThemeInstaller.php b/src/ThemeInstaller.php index b129d78..fe9fc35 100644 --- a/src/ThemeInstaller.php +++ b/src/ThemeInstaller.php @@ -30,17 +30,15 @@ public function getInstallPath(PackageInterface $package) */ protected function getBaseInstallationPath() { - if (!$this->composer || !$this->composer->getPackage()) { - return 'themes'; - } - - $extra = $this->composer->getPackage()->getExtra(); + if ($this->composer && $this->composer->getPackage()) { + $extra = $this->composer->getPackage()->getExtra(); - if (!$extra || empty($extra['theme-dir'])) { - return 'themes'; + if (array_key_exists('theme-dir', $extra)) { + return $extra['theme-dir']; + } } - return $extra['theme-dir']; + return 'themes'; } /**