дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-27 13:06:07 +02:00
PHP had no regression coverage. Adds a php-app fixture (Composer + Pest) with language, run and debug smoke cases, and a php entry in the Language smoke workflow: PHP 8.5 with Xdebug via setup-php, Intelephense pinned like the other servers. Other languages' selectors are unchanged. Co-authored-by: lleviathe <[email protected]>
19 рядки
410 B
PHP
19 рядки
410 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Shipping;
|
|
|
|
final readonly class Tariff
|
|
{
|
|
/** @param array<string, int> $centsPerKg */
|
|
public function __construct(private array $centsPerKg) {}
|
|
|
|
public function freightCents(Parcel $parcel, Route $route): int
|
|
{
|
|
$grams = $parcel->billableGrams($route);
|
|
|
|
return intdiv($grams * $this->centsPerKg[$route->value] + 999, 1000);
|
|
}
|
|
}
|