‪TYPO3CMS  10.4
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 {
28  protected ‪$value;
29 
33  protected ‪$type;
34 
38  protected ‪$length;
39 
43  protected ‪$ident;
44 
45  public static function ‪raw(string ‪$value): self
46  {
48  }
49 
50  public static function ‪expression(string ‪$value): self
51  {
53  }
54 
55  public function ‪__construct(string ‪$value, string ‪$type)
56  {
57  if (‪$value === '') {
58  throw new \LogicException('Value must not be empty', 1651671582);
59  }
60  $this->value = ‪$value;
61  $this->type = ‪$type;
62  $this->length = strlen(‪$value);
63  $this->ident = md5(‪$type . '::' . (‪$value));
64  }
65 
66  public function ‪__toString(): string
67  {
68  return ‪$this->value;
69  }
70 
71  public function ‪getValue(): string
72  {
73  return ‪$this->value;
74  }
75 
76  public function ‪getType(): string
77  {
78  return ‪$this->type;
79  }
80 
81  public function ‪getLength(): int
82  {
83  return ‪$this->length;
84  }
85 
86  public function ‪getIdent(): string
87  {
88  return ‪$this->ident;
89  }
90 }
‪TYPO3\CMS\Core\Utility\String\StringFragment\$value
‪string $value
Definition: StringFragment.php:27
‪TYPO3\CMS\Core\Utility\String\StringFragment\getLength
‪getLength()
Definition: StringFragment.php:77
‪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:35
‪TYPO3\CMS\Core\Utility\String\StringFragment\getIdent
‪getIdent()
Definition: StringFragment.php:82
‪TYPO3\CMS\Core\Utility\String\StringFragment\$ident
‪string $ident
Definition: StringFragment.php:39
‪TYPO3\CMS\Core\Utility\String\StringFragment\__construct
‪__construct(string $value, string $type)
Definition: StringFragment.php:51
‪TYPO3\CMS\Core\Utility\String\StringFragment\expression
‪static expression(string $value)
Definition: StringFragment.php:46
‪TYPO3\CMS\Core\Utility\String\StringFragment\getType
‪getType()
Definition: StringFragment.php:72
‪TYPO3\CMS\Core\Utility\String\StringFragment\getValue
‪getValue()
Definition: StringFragment.php:67
‪TYPO3\CMS\Core\Utility\String\StringFragment\raw
‪static raw(string $value)
Definition: StringFragment.php:41
‪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:31
‪TYPO3\CMS\Core\Utility\String\StringFragment
Definition: StringFragment.php:24
‪TYPO3\CMS\Core\Utility\String\StringFragment\__toString
‪__toString()
Definition: StringFragment.php:62