first commit
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-09-28 10:01:09 +02:00
commit 250ac35fd1
481 changed files with 92144 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Services;
use InvalidArgumentException;
final class EducationGapCalculator
{
/** @return array{state:string, people:?int} */
public function observed(?int $demand, ?int $available, bool $comparable, bool $current): array
{
if (($demand !== null && $demand < 0) || ($available !== null && $available < 0)) {
throw new InvalidArgumentException('Quantities cannot be negative.');
}
if (! $current) {
return ['state' => 'expired', 'people' => null];
}
if (! $comparable) {
return ['state' => 'incomparable', 'people' => null];
}
if ($demand === null || $available === null) {
return ['state' => 'insufficient_data', 'people' => null];
}
return ['state' => 'observed_unvalidated', 'people' => max(0, $demand - $available)];
}
}