‪TYPO3CMS  10.4
EntityUidPointer.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 
24 {
28  protected ‪$name;
29 
33  protected ‪$identifier;
34 
39  public function ‪__construct(string ‪$name, string ‪$identifier)
40  {
41  $this->name = ‪$name;
42  $this->identifier = ‪$identifier;
43  }
44 
48  public function ‪getName(): string
49  {
50  return ‪$this->name;
51  }
52 
56  public function ‪getIdentifier(): string
57  {
58  return ‪$this->identifier;
59  }
60 
65  public function ‪withUid(string ‪$identifier): self
66  {
67  if ($this->identifier === ‪$identifier) {
68  return $this;
69  }
70  $target = clone $this;
71  $target->identifier = ‪$identifier;
72  return $target;
73  }
74 
78  public function ‪isNode(): bool
79  {
80  return $this->name === 'pages';
81  }
82 
87  public function ‪isEqualTo(‪EntityPointer $other): bool
88  {
89  return $this->identifier === $other->‪getIdentifier()
90  && $this->name === $other->‪getName();
91  }
92 }
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer
Definition: EntityPointer.php:24
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer
Definition: EntityUidPointer.php:24
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\$name
‪string $name
Definition: EntityUidPointer.php:27
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer\getIdentifier
‪string getIdentifier()
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\isEqualTo
‪bool isEqualTo(EntityPointer $other)
Definition: EntityUidPointer.php:85
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\getName
‪string getName()
Definition: EntityUidPointer.php:46
‪TYPO3\CMS\Core\DataHandling\Model
Definition: CorrelationId.php:18
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\__construct
‪__construct(string $name, string $identifier)
Definition: EntityUidPointer.php:37
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\$identifier
‪string $identifier
Definition: EntityUidPointer.php:31
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\withUid
‪static withUid(string $identifier)
Definition: EntityUidPointer.php:63
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\getIdentifier
‪string getIdentifier()
Definition: EntityUidPointer.php:54
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer\getName
‪string getName()
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\isNode
‪bool isNode()
Definition: EntityUidPointer.php:76