‪TYPO3CMS  ‪main
IncludeTreeConditionAggregatorVisitor.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 
22 
32 {
36  private array ‪$conditions = [];
37 
41  public function ‪getConditions(): array
42  {
43  return ‪$this->conditions;
44  }
45 
46  public function ‪visitBeforeChildren(‪IncludeInterface $include, int $currentDepth): void
47  {
48  // No-op. Magic happens in visit()
49  }
50 
55  public function ‪visit(‪IncludeInterface $include, int $currentDepth): void
56  {
57  if (!$include instanceof ‪IncludeConditionInterface) {
58  return;
59  }
60  $condition = $include->getConditionToken()->getValue();
61  if (!in_array($condition, array_column($this->conditions, 'value'))) {
62  $this->conditions[] = [
63  'value' => $condition,
64  'originalValue' => $include->getOriginalConditionToken()?->getValue(),
65  ];
66  }
67  }
68 }
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeConditionAggregatorVisitor\visitBeforeChildren
‪visitBeforeChildren(IncludeInterface $include, int $currentDepth)
Definition: IncludeTreeConditionAggregatorVisitor.php:46
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeVisitorInterface
Definition: IncludeTreeVisitorInterface.php:28
‪TYPO3\CMS\Core\TypoScript\IncludeTree\IncludeNode\IncludeConditionInterface
Definition: IncludeConditionInterface.php:32
‪TYPO3\CMS\Core\TypoScript\IncludeTree\IncludeNode\IncludeInterface
Definition: IncludeInterface.php:39
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeConditionAggregatorVisitor\getConditions
‪getConditions()
Definition: IncludeTreeConditionAggregatorVisitor.php:41
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeConditionAggregatorVisitor\$conditions
‪array $conditions
Definition: IncludeTreeConditionAggregatorVisitor.php:36
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeConditionAggregatorVisitor\visit
‪visit(IncludeInterface $include, int $currentDepth)
Definition: IncludeTreeConditionAggregatorVisitor.php:55
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor\IncludeTreeConditionAggregatorVisitor
Definition: IncludeTreeConditionAggregatorVisitor.php:32
‪TYPO3\CMS\Core\TypoScript\IncludeTree\Visitor
Definition: IncludeTreeAstBuilderVisitor.php:18