‪TYPO3CMS  9.5
EntityUidPointer.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
23 {
27  protected ‪$name;
28 
32  protected ‪$identifier;
33 
38  public function ‪__construct(string ‪$name, string ‪$identifier)
39  {
40  $this->name = ‪$name;
41  $this->identifier = ‪$identifier;
42  }
43 
47  public function ‪getName(): string
48  {
49  return ‪$this->name;
50  }
51 
55  public function ‪getIdentifier(): string
56  {
57  return ‪$this->identifier;
58  }
59 
64  public function ‪withUid(string ‪$identifier): self
65  {
66  if ($this->identifier === ‪$identifier) {
67  return $this;
68  }
69  $target = clone $this;
70  $target->identifier = ‪$identifier;
71  return $target;
72  }
73 
77  public function ‪isNode(): bool
78  {
79  return $this->name === 'pages';
80  }
81 
86  public function ‪isEqualTo(‪EntityPointer $other): bool
87  {
88  return $this->identifier === $other->‪getIdentifier()
89  && $this->name === $other->‪getName();
90  }
91 }
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer
Definition: EntityPointer.php:23
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer
Definition: EntityUidPointer.php:23
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\$name
‪string $name
Definition: EntityUidPointer.php:26
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer\getIdentifier
‪string getIdentifier()
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\isEqualTo
‪bool isEqualTo(EntityPointer $other)
Definition: EntityUidPointer.php:84
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\getName
‪string getName()
Definition: EntityUidPointer.php:45
‪TYPO3\CMS\Core\DataHandling\Model
Definition: EntityContext.php:4
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\__construct
‪__construct(string $name, string $identifier)
Definition: EntityUidPointer.php:36
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\$identifier
‪string $identifier
Definition: EntityUidPointer.php:30
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\withUid
‪static withUid(string $identifier)
Definition: EntityUidPointer.php:62
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\getIdentifier
‪string getIdentifier()
Definition: EntityUidPointer.php:53
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer\getName
‪string getName()
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\isNode
‪bool isNode()
Definition: EntityUidPointer.php:75