ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Group.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Refinery\String;
22 
24 use ilLanguage;
27 use ILIAS\Refinery\String\Encoding\Group as EncodingGroup;
28 
29 class Group
30 {
33 
34  public function __construct(Factory $dataFactory, ilLanguage $language)
35  {
36  $this->dataFactory = $dataFactory;
37  $this->language = $language;
38  }
39 
48  public function hasMinLength(int $minimum): Constraint
49  {
50  return new HasMinLength($minimum, $this->dataFactory, $this->language);
51  }
52 
61  public function hasMaxLength(int $maximum): Constraint
62  {
63  return new HasMaxLength($maximum, $this->dataFactory, $this->language);
64  }
65 
70  public function splitString(string $delimiter): Transformation
71  {
72  return new SplitString($delimiter, $this->dataFactory);
73  }
74 
80  public function stripTags(): Transformation
81  {
82  return new StripTags();
83  }
84 
90  public function caseOfLabel(string $language_key): Transformation
91  {
92  return new CaseOfLabel($language_key);
93  }
94 
104  public function estimatedReadingTime(bool $withImages = false): Transformation
105  {
106  return new EstimatedReadingTime($withImages);
107  }
108 
113  public function makeClickable(): Transformation
114  {
115  return new MakeClickable();
116  }
117 
125  public function levenshtein(): Levenshtein
126  {
127  return new Levenshtein();
128  }
129 
135  public function utfnormal(): UTFNormal
136  {
137  return new UTFNormal();
138  }
139 
144  public function markdown(bool $escape = true): MarkdownFormattingToHTML
145  {
146  return new MarkdownFormattingToHTML($escape);
147  }
148 
152  public function encoding(): EncodingGroup
153  {
154  return new EncodingGroup();
155  }
156 }
splitString(string $delimiter)
Creates a transformation that can be used to split a given string by given delimiter.
Definition: Group.php:70
Split a string by delimiter into array.
Definition: SplitString.php:32
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
hasMaxLength(int $maximum)
Creates a constraint that can be used to check if a string has exceeded a maximum length...
Definition: Group.php:61
markdown(bool $escape=true)
This method returns an instance of the MarkdownFormattingToHTML class which can be used to tranform a...
Definition: Group.php:144
utfnormal()
This method returns an instance of the UTFNormal class which can be used to get Transformations that ...
Definition: Group.php:135
levenshtein()
This method returns an instance of the Levenshtein class, to call the constructor of the LevenshteinT...
Definition: Group.php:125
__construct(Factory $dataFactory, ilLanguage $language)
Definition: Group.php:34
caseOfLabel(string $language_key)
Creates a transformation that can be used to format a text for the title capitalization presentation ...
Definition: Group.php:90
makeClickable()
Creates a transformation to replace URL&#39;s like www.ilias.de to www.ilias.de.
Definition: Group.php:113
Strip tags from a string.
Definition: StripTags.php:31
hasMinLength(int $minimum)
Creates a constraint that can be used to check if a string has reached a minimum length.
Definition: Group.php:48
encoding()
This method returns a group of string encoding transformations.
Definition: Group.php:152
stripTags()
Creates a transformation that strips tags from a string.
Definition: Group.php:80
estimatedReadingTime(bool $withImages=false)
Creates a transformation to determine the estimated reading time of a human adult (roughly 275 WPM) I...
Definition: Group.php:104
A transformation is a function from one datatype to another.
This class provides a transformation that converts Markdown formatting to HTML using the CommonMark L...