Files
compras/integrations/sgf/internal-requisitions/bootstrap.php
T
nala c9bd6db90b
tests / ci (push) Canceled after 0s
commit compras2 3011
2026-11-30 23:04:25 +02:00

21 lines
1008 B
PHP

<?php
// Explicit candidate entry point. Not referenced by the normal SGF provider/routes.
foreach (['RequisitionPort', 'RequisitionFailure', 'InternalRequisitions'] as $class) {
require_once dirname(__DIR__, 3).'/packages/purchasing/src/'.$class.'.php';
}
foreach (['Schema', 'Port', 'Controller'] as $class) {
require_once __DIR__.'/'.$class.'.php';
}
(static function (): void {
$file = dirname(__DIR__, 3).'/manifest.json';
$format = is_file($file) ? (json_decode(file_get_contents($file), true, 32, JSON_THROW_ON_ERROR)['format'] ?? null) : 'tempo.operational-review.v1';
if (! in_array($format, ['tempo.operational-review.v1', 'tempo.operational-review.v2'], true)) {
throw new RuntimeException('Composição de requisições desconhecida.');
}
// Preserve the historical v1 bootstrap. A v2 code delivery never enables a capability.
if ($format === 'tempo.operational-review.v1') {
config(['purchasing-internal.candidate_enabled' => true]);
}
})();