/** * Creates a new match result from a child match. * * @param self $childMatchResult * @param array $parentParams * @param string $childRouteName * @return self * @throws DomainException */ public static function fromChildMatch(self $childMatchResult, $parentParams, $childRouteName) { if (!$childMatchResult->isSuccess()) { throw new DomainException('Child match must be a successful match result'); } $matchResult = self::fromSuccess($childMatchResult->getParams() + $parentParams); $matchResult->routeName = $childRouteName; if (null !== $childMatchResult->getRouteName()) { $matchResult->routeName .= '/' . $childMatchResult->getRouteName(); } return $matchResult; }