‪TYPO3CMS  ‪main
ResourceMatcher.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
26 {
30  protected array ‪$resources = [];
31 
35  public function ‪setResources(array ‪$resources): self
36  {
37  $this->resources = ‪$resources;
38 
39  return $this;
40  }
41 
42  public function ‪addResource(‪ResourceInterface $resource): self
43  {
44  $this->resources[] = $resource;
45 
46  return $this;
47  }
48 
49  public function ‪supports(mixed $item): bool
50  {
51  return $item instanceof ‪ResourceInterface;
52  }
53 
54  public function ‪match(mixed $item): bool
55  {
56  return in_array($item, $this->resources);
57  }
58 }
‪TYPO3\CMS\Filelist\Matcher\ResourceMatcher
Definition: ResourceMatcher.php:26
‪TYPO3\CMS\Filelist\Matcher\ResourceMatcher\setResources
‪setResources(array $resources)
Definition: ResourceMatcher.php:35
‪TYPO3\CMS\Filelist\Matcher\ResourceMatcher\$resources
‪array $resources
Definition: ResourceMatcher.php:30
‪TYPO3\CMS\Filelist\Matcher\ResourceMatcher\supports
‪supports(mixed $item)
Definition: ResourceMatcher.php:49
‪TYPO3\CMS\Filelist\Matcher\ResourceMatcher\match
‪match(mixed $item)
Definition: ResourceMatcher.php:54
‪TYPO3\CMS\Filelist\Matcher\MatcherInterface
Definition: MatcherInterface.php:24
‪TYPO3\CMS\Filelist\Matcher
Definition: Matcher.php:18
‪TYPO3\CMS\Filelist\Matcher\ResourceMatcher\addResource
‪addResource(ResourceInterface $resource)
Definition: ResourceMatcher.php:42
‪TYPO3\CMS\Core\Resource\ResourceInterface
Definition: ResourceInterface.php:21