‪TYPO3CMS  11.5
StringFragment.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 {
25  protected string ‪$value;
26  protected string ‪$type;
27  protected int ‪$length;
28  protected string ‪$ident;
29 
30  public static function ‪raw(string ‪$value): self
31  {
33  }
34 
35  public static function ‪expression(string ‪$value): self
36  {
38  }
39 
40  public function ‪__construct(string ‪$value, string ‪$type)
41  {
42  if (‪$value === '') {
43  throw new \LogicException('Value must not be empty', 1651671582);
44  }
45  $this->value = ‪$value;
46  $this->type = ‪$type;
47  $this->length = strlen(‪$value);
48  $this->ident = md5(‪$type . '::' . (‪$value));
49  }
50 
51  public function ‪__toString(): string
52  {
53  return ‪$this->value;
54  }
55 
56  public function ‪getValue(): string
57  {
58  return ‪$this->value;
59  }
60 
61  public function ‪getType(): string
62  {
63  return ‪$this->type;
64  }
65 
66  public function ‪getLength(): int
67  {
68  return ‪$this->length;
69  }
70 
71  public function ‪getIdent(): string
72  {
73  return ‪$this->ident;
74  }
75 }
‪TYPO3\CMS\Core\Utility\String\StringFragment\$value
‪string $value
Definition: StringFragment.php:25
‪TYPO3\CMS\Core\Utility\String\StringFragment\getLength
‪getLength()
Definition: StringFragment.php:66
‪TYPO3\CMS\Core\Utility\String\StringFragmentSplitter\TYPE_RAW
‪const TYPE_RAW
Definition: StringFragmentSplitter.php:31
‪TYPO3\CMS\Core\Utility\String\StringFragment\$length
‪int $length
Definition: StringFragment.php:27
‪TYPO3\CMS\Core\Utility\String\StringFragment\getIdent
‪getIdent()
Definition: StringFragment.php:71
‪TYPO3\CMS\Core\Utility\String\StringFragment\$ident
‪string $ident
Definition: StringFragment.php:28
‪TYPO3\CMS\Core\Utility\String\StringFragment\__construct
‪__construct(string $value, string $type)
Definition: StringFragment.php:40
‪TYPO3\CMS\Core\Utility\String\StringFragment\expression
‪static expression(string $value)
Definition: StringFragment.php:35
‪TYPO3\CMS\Core\Utility\String\StringFragment\getType
‪getType()
Definition: StringFragment.php:61
‪TYPO3\CMS\Core\Utility\String\StringFragment\getValue
‪getValue()
Definition: StringFragment.php:56
‪TYPO3\CMS\Core\Utility\String\StringFragment\raw
‪static raw(string $value)
Definition: StringFragment.php:30
‪TYPO3\CMS\Core\Utility\String
Definition: StringFragment.php:18
‪TYPO3\CMS\Core\Utility\String\StringFragmentSplitter\TYPE_EXPRESSION
‪const TYPE_EXPRESSION
Definition: StringFragmentSplitter.php:36
‪TYPO3\CMS\Core\Utility\String\StringFragment\$type
‪string $type
Definition: StringFragment.php:26
‪TYPO3\CMS\Core\Utility\String\StringFragment
Definition: StringFragment.php:24
‪TYPO3\CMS\Core\Utility\String\StringFragment\__toString
‪__toString()
Definition: StringFragment.php:51