expected[] = [$method, $sql, $result]; } public function __call(string $method, array $arguments): mixed { if (!$this->expected) { throw new RuntimeException('Unexpected database operation: ' . $method); } [$expectedMethod, $expectedSql, $result] = array_shift($this->expected); if ($method !== $expectedMethod || $arguments !== [$expectedSql]) { throw new RuntimeException('Unexpected fixture query: ' . $method . ' ' . ($arguments[0] ?? '')); } return $result; } } final class FixtureRows { private int $index = 0; public bool $freed = false; public function __construct(private array $rows) {} public function fetch_assoc(): ?array { return $this->rows[$this->index++] ?? null; } public function fetchRow(): ?array { return $this->fetch_assoc(); } public function free(): void { $this->freed = true; } } final class DB { public static function isError(mixed $value): bool { return $value instanceof Throwable; } } function getParameterValue($employee, $key, $hq) { if (!in_array($key, ['DB_FIELDTYPE_WRAPPER_1', 'COUNTRY_FON_PREFIX', 'INV_PRINT_DISCOUNT', 'INV_USE_EURO_SIGN', 'MASK_MARKUP_MODE'], true)) { throw new RuntimeException('Unexpected parameter: ' . $key); } return FixtureState::$parameters[$hq][$key] ?? ''; } function getServiceValues(...$arguments) { if (!FixtureState::$serviceCalls) { throw new RuntimeException('Unexpected service lookup'); } [$expected, $result] = array_shift(FixtureState::$serviceCalls); if ($arguments !== $expected) { throw new RuntimeException('Service lookup arguments differ: ' . json_encode($arguments)); } return $result; } function insertStmt($table, $row) { if ($table !== 'phoenix_log.b2b_objects') { throw new RuntimeException('Unexpected write target: ' . $table); } FixtureState::$writes[] = [$table, $row]; } function writeLog_($file, $message) { FixtureState::$logs[] = [$file, $message]; } function reportDie($message) { throw new RuntimeException($message); }