‪TYPO3CMS  ‪main
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 
35  public function ‪__construct(string ‪$name, string ‪$identifier)
36  {
37  $this->name = ‪$name;
38  $this->identifier = ‪$identifier;
39  }
40 
41  public function ‪getName(): string
42  {
43  return ‪$this->name;
44  }
45 
46  public function ‪getIdentifier(): string
47  {
48  return ‪$this->identifier;
49  }
50 
54  public function ‪withUid(string ‪$identifier): self
55  {
56  if ($this->identifier === ‪$identifier) {
57  return $this;
58  }
59  $target = clone $this;
60  $target->identifier = ‪$identifier;
61  return $target;
62  }
63 
64  public function ‪isNode(): bool
65  {
66  return $this->name === 'pages';
67  }
68 
69  public function ‪isEqualTo(‪EntityPointer $other): bool
70  {
71  return $this->identifier === $other->‪getIdentifier()
72  && $this->name === $other->‪getName();
73  }
74 }
‪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\EntityUidPointer\getIdentifier
‪getIdentifier()
Definition: EntityUidPointer.php:44
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer\getName
‪getName()
‪TYPO3\CMS\Core\DataHandling\Model
Definition: CorrelationId.php:18
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\isNode
‪isNode()
Definition: EntityUidPointer.php:62
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\__construct
‪__construct(string $name, string $identifier)
Definition: EntityUidPointer.php:33
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\$identifier
‪string $identifier
Definition: EntityUidPointer.php:31
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\isEqualTo
‪isEqualTo(EntityPointer $other)
Definition: EntityUidPointer.php:67
‪TYPO3\CMS\Core\DataHandling\Model\EntityPointer\getIdentifier
‪getIdentifier()
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\withUid
‪static withUid(string $identifier)
Definition: EntityUidPointer.php:52
‪TYPO3\CMS\Core\DataHandling\Model\EntityUidPointer\getName
‪getName()
Definition: EntityUidPointer.php:39