private static function roundHalfToEven($amount)
    {
        $result = self::roundToNearestIntegerIgnoringTies($amount);

        if (null == $result) {
            $truncated = self::roundHalfTowardsZero($amount);

            if (0 == bcmod($truncated, '2')) { // Even
                $result = $truncated;
            } else {
                $result = self::roundHalfAwayFromZero($amount);
            }
        }

        return $result;
    }