‪TYPO3CMS  ‪main
SoftReferenceParserResult.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 
43 {
44  private string ‪$content = '';
45  private array ‪$elements = [];
46  private bool ‪$hasMatched = false;
47 
48  public static function ‪create(string ‪$content, array ‪$elements): self
49  {
50  if (‪$elements === []) {
52  }
53 
54  $obj = new self();
55  $obj->content = ‪$content;
56  $obj->elements = ‪$elements;
57  $obj->hasMatched = true;
58 
59  return $obj;
60  }
61 
62  public static function ‪createWithoutMatches(): self
63  {
64  return new self();
65  }
66 
67  public function ‪hasMatched(): bool
68  {
69  return ‪$this->hasMatched;
70  }
71 
72  public function ‪hasContent(): bool
73  {
74  return $this->content !== '';
75  }
76 
77  public function ‪getContent(): string
78  {
79  return ‪$this->content;
80  }
81 
82  public function ‪getMatchedElements(): array
83  {
84  return ‪$this->elements;
85  }
86 }
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\getContent
‪getContent()
Definition: SoftReferenceParserResult.php:77
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\create
‪static create(string $content, array $elements)
Definition: SoftReferenceParserResult.php:48
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\hasContent
‪hasContent()
Definition: SoftReferenceParserResult.php:72
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\$hasMatched
‪bool $hasMatched
Definition: SoftReferenceParserResult.php:46
‪TYPO3\CMS\Core\DataHandling\SoftReference
Definition: AbstractSoftReferenceParser.php:18
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\$content
‪string $content
Definition: SoftReferenceParserResult.php:44
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\createWithoutMatches
‪static createWithoutMatches()
Definition: SoftReferenceParserResult.php:62
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult
Definition: SoftReferenceParserResult.php:43
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\getMatchedElements
‪getMatchedElements()
Definition: SoftReferenceParserResult.php:82
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\$elements
‪array $elements
Definition: SoftReferenceParserResult.php:45
‪TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\hasMatched
‪hasMatched()
Definition: SoftReferenceParserResult.php:67