@param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo

@note Matched config is cached in memory by underlying matcher factory.

@return array|null
549954
private function getCommentsConfig(ContentInfo $contentInfo)
    {
        $view = new ContentView(null, [], 'comments');
        $view->setContent($this->contentService->loadContentByContentInfo($contentInfo));

        return $this->matcherFactory->match($view);
    }
412362
private function loadParentLocations(ContentInfo $contentInfo)
    {
        $locations = $this->persistence->locationHandler()->loadLocationsByContent($contentInfo->id);
        $parentLocations = [];
        foreach ($locations as $location) {
            if ($location->depth > 0) {
                $parentLocations[] = $this->persistence->locationHandler()->load($location->parentId);
            }
        }

        return $parentLocations;
    }
601802
protected function setContentPath($contentPath)
    {
        $contentPath = realpath($contentPath);

        if(false === $contentPath)
        {
            throw new ConfigurationException("Unable to realpath: [$contentPath]");
        }

        $this->contentPath = $contentPath;
    }
1351006
public function load(ContentInfo $contentInfo): self
    {
        $data = array_map(
            function (ObjectStateGroup $objectStateGroup) use ($contentInfo) {
                $hasObjectStates = !empty($this->objectStateService->loadObjectStates($objectStateGroup));
                if (!$hasObjectStates) {
                    return [];
                }

                return $this->valueFactory->createObjectState($contentInfo, $objectStateGroup);
            },
            $this->objectStateService->loadObjectStateGroups()
        );

        // Get rid of empty Object State Groups
        $this->data = array_filter($data);

        return $this;
    }
5649
public function renderForContent(ContentInfo $contentInfo, Request $request, array $options = array())
    {
        $foo = $this->locationService->loadLocation($contentInfo->mainLocationId);

        return $this->doRender(
            $options + array(
                'app_id' => $this->appId,
                'width' => $this->defaultWidth,
                'num_posts' => $this->defaultNumPosts,
                'color_scheme' => $this->defaultColorScheme,
                'include_sdk' => $this->defaultIncludeSDK,
                'url' => $this->router->generate($foo, array(), true),
            )
        );
    }
786014
protected function completeContentInfo(Values\RestContentInfo $restContentInfo)
    {
        $versionUrlValues = $this->requestParser->parse(
            'objectVersion',
            $this->fetchCurrentVersionUrl($restContentInfo->currentVersionReference)
        );

        return new Values\Content\ContentInfo(
            $this->contentTypeService,
            array(
                'id' => $restContentInfo->id,
                'name' => $restContentInfo->name,
                'contentTypeId' => $restContentInfo->contentTypeId,
                'ownerId' => $restContentInfo->ownerId,
                'modificationDate' => $restContentInfo->modificationDate,
                'publishedDate' => $restContentInfo->publishedDate,
                'published' => $restContentInfo->published,
                'alwaysAvailable' => $restContentInfo->alwaysAvailable,
                'remoteId' => $restContentInfo->remoteId,
                'mainLanguageCode' => $restContentInfo->mainLanguageCode,
                'mainLocationId' => $restContentInfo->mainLocationId,
                'sectionId' => $restContentInfo->sectionId,

                'currentVersionNo' => $versionUrlValues['version'],
            )
        );
    }
1339846
public function resolveContentId($contentTypeId, $contentId)
    {
        // content type ?
        if (!$contentType = $this->contentTypeLoader->retrieve($contentTypeId)) {
            throw new InvalidContentException(sprintf(
                'No content type registered under "%s" id, check you configuration.',
                $contentTypeId
            ));
        }

        // content object
        if (!$content = $contentType->retrieveContent($contentId)) {
            throw new InvalidContentException(sprintf(
                'Unable to get a "%s" content under "%s" id.',
                $contentType->getName(),
                $contentId
            ));
        }

        return $this->wrap($contentType, $content);
    }
1091876
private function resolveContentEditData(
        Content $content,
        string $languageCode,
        ContentType $contentType
    ): ContentUpdateData {
        $contentUpdateMapper = new ContentUpdateMapper();

        return $contentUpdateMapper->mapToFormData($content, [
            'languageCode' => $languageCode,
            'contentType' => $contentType,
        ]);
    }
111005
static function FindContentRights(Content $content)
    {
        $result = null;
        $currContent = $content;
        do
        {
            $result = $currContent->GetUserGroupRights();
            $currContent = ContentTreeUtil::ParentOf($currContent);
        } 
        while (!$result && $currContent);
        if ($result)
        {
            return $result;
        }
        return self::GetUpperContentRights($content);
    }
704052
public function deleteContent($contentId)
    {
        $this->repository->getContentService()->deleteContent(
            $this->repository->getContentService()->loadContentInfo($contentId)
        );

        return new Values\NoContent();
    }
350638
private function getCacheItemMatch($pathinfo)
    {
        /** @type RequestContext $c */
        $c   = $this->getContext();
        $key = sprintf('%s__%s__%s__%s', $c->getHost(), $pathinfo, $c->getMethod(), $c->getQueryString());

        return $this->getCacheItemFromKey($key, 'match');
    }
1042764
protected function getFileContent(Content $content)
    {
        $text = @file_get_contents($this->contentPath . $content->getPath());

        // @codeCoverageIgnoreStart
        if(null === $this->getContentPath())
        {
            throw new ConfigurationException('ContentPath is not set. Call setContentPath before reading a file content.');
        }
        // @codeCoverageIgnoreEnd

        if(false === $text)
        {
            throw new RenderException('Unable to read: ' . $content->getPath() . '. Full path: ' . ($this->getContentPath() . $content->getPath()));
        }

        return $text;
    }
730343
protected function checkContent($contentId)
    {
        /** @var \eZ\Publish\API\Repository\Values\Content\Content $content */
        $content = $this->repository->sudo(
            function (Repository $repository) use ($contentId) {
                return $repository->getContentService()->loadContent($contentId);
            }
        );

        $this->checkContentPermissions($content);
    }
994917
public function mapContent(Content $content)
    {
        $locations = $this->locationHandler->loadLocationsByContent($content->versionInfo->contentInfo->id);
        $section = $this->sectionHandler->load($content->versionInfo->contentInfo->sectionId);
        $mainLocation = null;
        $locationDocuments = array();
        foreach ($locations as $location) {
            $locationDocuments[] = $this->mapContentLocation($location, $content);
        }

        // UserGroups and Users are Content, but permissions cascade is achieved through
        // Locations hierarchy. We index all ancestor Location Content ids of all
        // Locations of an owner.
        $ancestorLocationsContentIds = $this->getAncestorLocationsContentIds(
            $content->versionInfo->contentInfo->ownerId
        );
        // Add owner user id as it can also be considered as user group.
        $ancestorLocationsContentIds[] = $content->versionInfo->contentInfo->ownerId;

        $fields = array(
            new Field(
                'id',
                $content->versionInfo->contentInfo->id,
                new FieldType\IdentifierField()
            ),
            new Field(
                'type',
                $content->versionInfo->contentInfo->contentTypeId,
                new FieldType\IdentifierField()
            ),
            new Field(
                'version',
                $content->versionInfo->versionNo,
                new FieldType\IdentifierField()
            ),
            new Field(
                'status',
                $content->versionInfo->status,
                new FieldType\IdentifierField()
            ),
            new Field(
                'name',
                $content->versionInfo->contentInfo->name,
                new FieldType\StringField()
            ),
            new Field(
                'creator',
                $content->versionInfo->creatorId,
                new FieldType\IdentifierField()
            ),
            new Field(
                'owner',
                $content->versionInfo->contentInfo->ownerId,
                new FieldType\IdentifierField()
            ),
            new Field(
                'owner_user_group',
                $ancestorLocationsContentIds,
                new FieldType\MultipleIdentifierField()
            ),
            new Field(
                'section',
                $content->versionInfo->contentInfo->sectionId,
                new FieldType\IdentifierField()
            ),
            new Field(
                'section_identifier',
                $section->identifier,
                new FieldType\IdentifierField()
            ),
            new Field(
                'section_name',
                $section->name,
                new FieldType\StringField()
            ),
            new Field(
                'remote_id',
                $content->versionInfo->contentInfo->remoteId,
                new FieldType\IdentifierField()
            ),
            new Field(
                'modified',
                $content->versionInfo->contentInfo->modificationDate,
                new FieldType\DateField()
            ),
            new Field(
                'published',
                $content->versionInfo->contentInfo->publicationDate,
                new FieldType\DateField()
            ),
            new Field(
                'language_code',
                array_keys($content->versionInfo->names),
                new FieldType\MultipleStringField()
            ),
            new Field(
                'always_available',
                $content->versionInfo->contentInfo->alwaysAvailable,
                new FieldType\BooleanField()
            ),
            new Field(
                'locations',
                $locationDocuments,
                new FieldType\DocumentField()
            ),
        );

        $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId);
        $fields[] = new Field(
            'group',
            $contentType->groupIds,
            new FieldType\MultipleIdentifierField()
        );
        $fields[] = new Field(
            'fields',
            $this->mapFields($content, $contentType),
            new FieldType\DocumentField()
        );

        $fields[] = new Field(
            'object_state',
            $this->getObjectStateIds($content->versionInfo->contentInfo->id),
            new FieldType\MultipleIdentifierField()
        );

        $document = new Document(
            array(
                'id' => $content->versionInfo->contentInfo->id,
                'type' => 'content',
                'fields' => $fields,
            )
        );

        return $document;
    }
922490
public function load(ContentInfo $contentInfo): self
    {
        $this->data = array_map(
            [$this->valueFactory, 'createVersionInfo'],
            $this->contentService->loadVersions($contentInfo)
        );

        return $this;
    }
662727
private function getTemplateFieldTemplates(ContentType $contentType, Content $content)
    {
        $templateFieldTemplates = [];
        $templateFieldsConfig = $this->config->get('theme/templatefields');

        if ($templateFieldsConfig) {
            $templateFieldTemplates = array_keys($templateFieldsConfig);
            // Special case for default template
            $toRepair = [];
            foreach ($contentType['fields'] as $name => $field) {
                if ($field['type'] === 'templateselect' && !empty($content->values[$name])) {
                    $toRepair[$name] = $content->values[$name];
                    $content->set($name, '');
                }
            }
            if ($content->hasTemplateFields()) {
                $templateFieldTemplates[] = '';
            }

            foreach ($toRepair as $name => $value) {
                $content->set($name, $value);
            }
        }

        return $templateFieldTemplates;
    }
1185812
public function parse($content)
    {
        $map = [];

        if (preg_match(self::CONFIGURATION_PATTERN, $content, $matches)) {
            if (preg_match(self::DATABASE_PATTERN, $matches[1], $database)) {
                $map[self::DATABASE_INDEX] = $database[1];
            }
            if (preg_match(self::COLLECTION_PATTERN, $matches[1], $collection)) {
                $map[self::COLLECTION_INDEX] = $collection[1];
            }
        }

        return $map;
    }