Skip to content

Commit

Permalink
refactor(installer): simplify getBaseInstallationPath function
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetan-hexadog committed Oct 24, 2020
1 parent 859ff20 commit 8257ca4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/ThemeInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

/**
Expand Down

0 comments on commit 8257ca4

Please sign in to comment.