Neos\Flow\Mvc\Routing\IdentityRoutePart::createPathSegmentForObject PHP Метод

createPathSegmentForObject() защищенный Метод

Creates a URI representation (path segment) for the given object matching $this->uriPattern.
protected createPathSegmentForObject ( mixed $object ) : string
$object mixed object of type $this->objectType
Результат string URI representation (path segment) of the given object
    protected function createPathSegmentForObject($object)
    {
        $matches = [];
        preg_match_all('/(?P<dynamic>{?)(?P<content>[^}{]+)}?/', $this->getUriPattern(), $matches, PREG_SET_ORDER);
        $pathSegment = '';
        foreach ($matches as $match) {
            if (empty($match['dynamic'])) {
                $pathSegment .= $match['content'];
            } else {
                $dynamicPathSegmentParts = explode(':', $match['content']);
                $propertyPath = $dynamicPathSegmentParts[0];
                $dynamicPathSegment = ObjectAccess::getPropertyPath($object, $propertyPath);
                if (is_object($dynamicPathSegment)) {
                    if ($dynamicPathSegment instanceof \DateTimeInterface) {
                        $dateFormat = isset($dynamicPathSegmentParts[1]) ? trim($dynamicPathSegmentParts[1]) : 'Y-m-d';
                        $pathSegment .= $this->rewriteForUri($dynamicPathSegment->format($dateFormat));
                    } else {
                        throw new InvalidUriPatternException(sprintf('Invalid uriPattern "%s" for route part "%s". Property "%s" must be of type string or \\DateTime. "%s" given.', $this->getUriPattern(), $this->getName(), $propertyPath, is_object($dynamicPathSegment) ? get_class($dynamicPathSegment) : gettype($dynamicPathSegment)), 1316442409);
                    }
                } else {
                    $pathSegment .= $this->rewriteForUri($dynamicPathSegment);
                }
            }
        }
        return $pathSegment;
    }