‪TYPO3CMS  ‪main
Variables.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 
20 class ‪Variables extends \ArrayObject
21 {
22  public static function ‪create(array $items = []): self
23  {
24  return new static($items);
25  }
26 
27  public function ‪keys(): array
28  {
29  return array_keys($this->getArrayCopy());
30  }
31 
32  public function ‪values(): array
33  {
34  return array_values($this->getArrayCopy());
35  }
36 
37  public function ‪define(array $items): self
38  {
39  $this->exchangeArray(array_merge(
40  $items,
41  $this->getArrayCopy()
42  ));
43  return $this;
44  }
45 
46  public function ‪merge(array $items): self
47  {
48  $this->exchangeArray(array_merge(
49  $this->getArrayCopy(),
50  $items
51  ));
52  return $this;
53  }
54 
55  public function ‪withDefined(?‪Variables $other): self
56  {
57  if ($other === null || $other === $this) {
58  return $this;
59  }
60  $target = clone $this;
61  $target->define($other->getArrayCopy());
62  return $target;
63  }
64 
65  public function ‪withMerged(?‪Variables $other): self
66  {
67  if ($other === null || $other === $this) {
68  return $this;
69  }
70  $target = clone $this;
71  $target->merge($other->getArrayCopy());
72  return $target;
73  }
74 }
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\withDefined
‪withDefined(?Variables $other)
Definition: Variables.php:55
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\merge
‪merge(array $items)
Definition: Variables.php:46
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables
Definition: Variables.php:21
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\values
‪values()
Definition: Variables.php:32
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\create
‪static create(array $items=[])
Definition: Variables.php:22
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\keys
‪keys()
Definition: Variables.php:27
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\withMerged
‪withMerged(?Variables $other)
Definition: Variables.php:65
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder
Definition: Applicable.php:18
‪TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Variables\define
‪define(array $items)
Definition: Variables.php:37