/** * Merges two method failure match results. * * @param self $firstMatchResult * @param self $secondMatchResult * @return self * @throws DomainException */ public static function mergeMethodFailures(self $firstMatchResult, self $secondMatchResult) { if (!$firstMatchResult->isMethodFailure() || !$secondMatchResult->isMethodFailure()) { throw new DomainException('Both match results must be method failures'); } return self::fromMethodFailure(array_unique(array_merge($firstMatchResult->getAllowedMethods(), $secondMatchResult->getAllowedMethods()))); }