Skip to content

Commit

Permalink
Merge branch '4.1' into 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bobdenotter committed Jun 14, 2021
2 parents 3e38b7c + b7de90f commit 9067764
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Command/ExtensionsConfigureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Bolt\Command;

use Bolt\Common\Str;
use Bolt\Extension\BaseExtension;
use Bolt\Extension\ExtensionRegistry;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -14,6 +15,7 @@

class ExtensionsConfigureCommand extends Command
{
/** @var string */
protected static $defaultName = 'extensions:configure';

/** @var ExtensionRegistry */
Expand Down Expand Up @@ -65,8 +67,8 @@ private function copyExtensionConfig(array $packages): void
foreach ($packages as $package) {
$path = $this->getPackagePath($package);

$this->copyConfig($this->getRelativePath($path) . '/config/config.yaml', $path);
$this->copyConfig($this->getRelativePath($path) . '/config/config.yml', $path);
$this->copyConfig($this->getRelativePath($path) . '/config/config.yaml', $package);
$this->copyConfig($this->getRelativePath($path) . '/config/config.yml', $package);
}
}

Expand Down Expand Up @@ -109,7 +111,7 @@ private function copyExtensionRoutesAndServices(array $packages): void
array_map('unlink', $oldExtensionsServices);
}

private function copyConfig(string $source, string $package): void
private function copyConfig(string $source, BaseExtension $package): void
{
[$namespace, $name] = explode('\\', mb_strtolower($this->getNamespace($package) . '\\'));
$destination = $this->getExtensionConfigPath($namespace, $name);
Expand Down Expand Up @@ -178,14 +180,14 @@ private function getExtensionConfigPath(string $namespace, string $name): string
$name);
}

private function getPackagePath($package): string
private function getPackagePath(BaseExtension $package): string
{
$reflection = new \ReflectionClass($package);

return dirname(dirname($reflection->getFilename()));
}

private function getNamespace($package): string
private function getNamespace(BaseExtension $package): string
{
$reflection = new \ReflectionClass($package);

Expand Down

0 comments on commit 9067764

Please sign in to comment.