style updates
This commit is contained in:
@@ -1,17 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Marketplace\Services;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
final class CompatibilityChecker
|
||||
{
|
||||
public function __construct(private VersionConstraint $constraints=new VersionConstraint()) {}
|
||||
public function __construct(private VersionConstraint $constraints = new VersionConstraint) {}
|
||||
|
||||
public function check(array $manifest): array
|
||||
{
|
||||
$errors=[];
|
||||
$php=(string)($manifest['php'] ?? '*'); $laravel=(string)($manifest['laravel'] ?? '*');
|
||||
$platform=(string)($manifest['content_manager'] ?? '*'); $platformVersion=(string) config('app.version','1.0.0');
|
||||
if (!$this->constraints->matches(PHP_VERSION,$php)) $errors[]="Requires PHP $php; running ".PHP_VERSION.'.';
|
||||
if (!$this->constraints->matches(App::version(),$laravel)) $errors[]="Requires Laravel $laravel; running ".App::version().'.';
|
||||
if (!$this->constraints->matches($platformVersion,$platform)) $errors[]="Requires Content Manager $platform; running $platformVersion.";
|
||||
return ['compatible'=>$errors===[],'errors'=>$errors];
|
||||
$errors = [];
|
||||
$php = (string) ($manifest['php'] ?? '*');
|
||||
$laravel = (string) ($manifest['laravel'] ?? '*');
|
||||
$platform = (string) ($manifest['content_manager'] ?? '*');
|
||||
$platformVersion = (string) config('app.version', '1.0.0');
|
||||
if (! $this->constraints->matches(PHP_VERSION, $php)) {
|
||||
$errors[] = "Requires PHP $php; running ".PHP_VERSION.'.';
|
||||
}
|
||||
if (! $this->constraints->matches(App::version(), $laravel)) {
|
||||
$errors[] = "Requires Laravel $laravel; running ".App::version().'.';
|
||||
}
|
||||
if (! $this->constraints->matches($platformVersion, $platform)) {
|
||||
$errors[] = "Requires Content Manager $platform; running $platformVersion.";
|
||||
}
|
||||
|
||||
return ['compatible' => $errors === [], 'errors' => $errors];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user