Files
kupshop/bundles/External/FlexiBeeBundle/Inspections/FlexiBeeInspection.php
2025-08-02 16:30:27 +02:00

41 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace External\FlexiBeeBundle\Inspections;
use Composer\InstalledVersions;
use KupShop\SystemInspectionBundle\Inspections\Compile\CompileInspectionInterface;
use KupShop\SystemInspectionBundle\Inspections\Inspection;
use KupShop\SystemInspectionBundle\InspectionWriters\MessageTypes\ComposerMissingMessage;
use KupShop\SystemInspectionBundle\InspectionWriters\MessageTypes\SimpleMessage;
class FlexiBeeInspection extends Inspection implements CompileInspectionInterface
{
public function runInspection(): ?array
{
$errors = [];
// check for stores module
if (!findModule(\Modules::STORES)) {
$errors[] = new SimpleMessage('Stores module is required when FlexiBeeBundle is enabled!');
}
// check for synchronization module
if (!findModule(\Modules::SYNCHRONIZATION)) {
$errors[] = new SimpleMessage('Synchronization module is required when FlexiBeeBundle is enabled!');
}
// check for composer package
try {
InstalledVersions::getVersion('spojenet/flexibee');
} catch (\Exception $e) {
$errors[] = new ComposerMissingMessage(
'Missing required composer dependency "spojenet/flexibee"! Run `composer require spojenet/flexibee` to fix it.'
);
}
return $errors;
}
}