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