for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Polyglot\Pluralization\Rules;
/**
* @package Polyglot/Pluralization/Rules
* @author Mihai MATEI <[email protected]>
*/
class Russian implements RuleInterface
{
* @inheritDoc
public function decide(int $n): int
$lastTwo = $n % 100;
$end = $lastTwo % 10;
if ($lastTwo !== 11 && $end === 1) {
return 0;
}
if (2 <= $end && $end <= 4 && !($lastTwo >= 12 && $lastTwo <= 14)) {
return 1;
return 2;