Skip to content

Commit

Permalink
fix: Enhance code quality and shell provider factoryr
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Huber committed Mar 1, 2025
1 parent f8a8228 commit f867dcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/Configuration/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,8 @@ public function getDockerConfig(string $config_name): ?DockerConfig
$shell_provider = ShellProviderFactory::create($data['shellProvider'], $this->logger);

$errors = new ValidationErrorBag();
if (!$shell_provider) {
$errors->addError('shellProvider', 'Unhandled shell-provider: `'.$data['shellProvider'].'`');
} else {
$data = Node::mergeData($shell_provider->getDefaultConfig($this, $data), $data);
$shell_provider->validateConfig($data, $errors);
}
$data = Node::mergeData($shell_provider->getDefaultConfig($this, $data), $data);
$shell_provider->validateConfig($data, $errors);
if ($errors->hasErrors()) {
throw new ValidationFailedException($errors);
}
Expand Down
4 changes: 3 additions & 1 deletion src/ShellProvider/ShellProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Phabalicious\ShellProvider;

use Psr\Log\LoggerInterface;

class ShellProviderFactory
{
public static function create($shell_provider_name, $logger): ?ShellProviderInterface
public static function create(string $shell_provider_name, LoggerInterface $logger): ShellProviderInterface
{
switch ($shell_provider_name) {
case LocalShellProvider::PROVIDER_NAME:
Expand Down

0 comments on commit f867dcf

Please sign in to comment.