<?php

function setIsFinished(int $home, int $away, int $setNumber): bool
{
    $target = $setNumber === 5 ? 15 : 25;
    return max($home, $away) >= $target && abs($home - $away) >= 2;
}

assert(setIsFinished(25, 23, 1) === true);
assert(setIsFinished(25, 24, 1) === false);
assert(setIsFinished(16, 14, 5) === true);
assert(setIsFinished(15, 14, 5) === false);
assert(setIsFinished(30, 28, 2) === true);

echo "ScoreRulesTest OK\n";
