vendor/ibexa/core/src/lib/MVC/Symfony/Matcher/ContentBased/Id/Location.php line 15

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. namespace Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id;
  7. use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
  8. use Ibexa\Contracts\Core\Repository\Values\Content\Location as APILocation;
  9. use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued;
  10. use Ibexa\Core\MVC\Symfony\View\LocationValueView;
  11. use Ibexa\Core\MVC\Symfony\View\View;
  12. class Location extends MultipleValued
  13. {
  14.     /**
  15.      * Checks if a Location object matches.
  16.      *
  17.      * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location
  18.      *
  19.      * @return bool
  20.      */
  21.     public function matchLocation(APILocation $location)
  22.     {
  23.         return isset($this->values[$location->id]);
  24.     }
  25.     /**
  26.      * Checks if a ContentInfo object matches.
  27.      *
  28.      * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo
  29.      *
  30.      * @return bool
  31.      */
  32.     public function matchContentInfo(ContentInfo $contentInfo)
  33.     {
  34.         return isset($this->values[$contentInfo->mainLocationId]);
  35.     }
  36.     public function match(View $view)
  37.     {
  38.         if (!$view instanceof LocationValueView) {
  39.             return false;
  40.         }
  41.         if (null === $view->getLocation()) {
  42.             return false;
  43.         }
  44.         return isset($this->values[$view->getLocation()->id]);
  45.     }
  46. }
  47. class_alias(Location::class, 'eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\Location');