move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +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 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];
}
}