Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/MVC/Symfony/Matcher/ContentBased/Depth.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased;
8
9 use eZ\Publish\API\Repository\Repository;
10 use eZ\Publish\API\Repository\Values\Content\Location;
11 use eZ\Publish\API\Repository\Values\Content\ContentInfo;
12 use eZ\Publish\Core\MVC\Symfony\View\ContentValueView;
13 use eZ\Publish\Core\MVC\Symfony\View\LocationValueView;
14 use eZ\Publish\Core\MVC\Symfony\View\View;
15
16 class Depth extends MultipleValued
17 {
25 public function matchLocation(Location $location)
26 {
27 return isset($this->values[$location->depth]);
28 }
29
37 public function matchContentInfo(ContentInfo $contentInfo)
38 {
39 $location = $this->repository->sudo(
40 function (Repository $repository) use ($contentInfo) {
41 return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
42 }
43 );
44
45 return isset($this->values[$location->depth]);
46 }
47
48 public function match(View $view)
49 {
50 if ($view instanceof LocationValueView) {
51 return isset($this->values[$view->getLocation()->depth]);
52 }
53
54 if ($view instanceof ContentValueView) {
55 return $this->matchContentInfo($view->getContent()->contentInfo);
56 }
57
58 return false;
59 }
60 }
eZ\Publish\API\Repository\Values\Content\ContentInfo
Definition: API/Repository/Values/Content/ContentInfo.php:31
eZ\Publish\API\Repository\Values\Content\Location
Definition: API/Repository/Values/Content/Location.php:32
eZ\Publish\Core\MVC\RepositoryAware\$repository
$repository
Definition: RepositoryAware.php:14
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth
Definition: Core/MVC/Symfony/Matcher/ContentBased/Depth.php:17
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth\match
match(View $view)
Matches the $view against a set of matchers.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Depth.php:48
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth\matchContentInfo
matchContentInfo(ContentInfo $contentInfo)
Checks if a ContentInfo object matches.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Depth.php:37
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth\matchLocation
matchLocation(Location $location)
Checks if a Location object matches.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Depth.php:25
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued
Abstract class for basic matchers, accepting multiple values to match against.
Definition: ContentBased/MultipleValued.php:15
eZ\Publish\API\Repository\Repository
Repository interface.
Definition: API/Repository/Repository.php:16
eZ\Publish\Core\MVC\Symfony\View\ContentValueView
A view that contains a Content.
Definition: ContentValueView.php:13
eZ\Publish\Core\MVC\Symfony\View\LocationValueView
Definition: LocationValueView.php:10
eZ\Publish\Core\MVC\Symfony\View\View
Main interface for Views of Value objects (content, block...).
Definition: Publish/Core/MVC/Symfony/View/View.php:16
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased
Definition: Core/MVC/Symfony/Matcher/ContentBased/Depth.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.