public function compute(Interval $first, Interval $second): ?Interval
    {
        if ($first->isNeighborBefore($second)) {
            return new Interval(
                $first->getEnd()->changeSide(),
                $second->getStart()->changeSide()
            );
        }

        if ($first->isNeighborAfter($second)) {
            return new Interval(
                $second->getEnd()->changeSide(),
                $first->getStart()->changeSide()
            );
        }

        if (!$first->overlaps($second)) {
            return null;
        }

        return new Interval(
            $first->getStart()->greaterThan($second->getStart()) ? $first->getStart() : $second->getStart(),
            $first->getEnd()->lessThan($second->getEnd()) ? $first->getEnd() : $second->getEnd()
        );
    }