ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Group.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Refinery\String;
22 
26 use ILIAS\Refinery\String\Encoding\Group as EncodingGroup;
27 
28 class Group
29 {
31  private \ILIAS\Language\Language $language;
32 
33  public function __construct(Factory $dataFactory, \ILIAS\Language\Language $language)
34  {
35  $this->dataFactory = $dataFactory;
36  $this->language = $language;
37  }
38 
47  public function hasMinLength(int $minimum): Constraint
48  {
49  return new HasMinLength($minimum, $this->dataFactory, $this->language);
50  }
51 
60  public function hasMaxLength(int $maximum): Constraint
61  {
62  return new HasMaxLength($maximum, $this->dataFactory, $this->language);
63  }
64 
69  public function splitString(string $delimiter): Transformation
70  {
71  return new SplitString($delimiter, $this->dataFactory);
72  }
73 
79  public function stripTags(): Transformation
80  {
81  return new StripTags();
82  }
83 
89  public function caseOfLabel(string $language_key): Transformation
90  {
91  return new CaseOfLabel($language_key);
92  }
93 
103  public function estimatedReadingTime(bool $withImages = false): Transformation
104  {
105  return new EstimatedReadingTime($withImages);
106  }
107 
112  public function makeClickable(): Transformation
113  {
114  return new MakeClickable();
115  }
116 
124  public function levenshtein(): Levenshtein
125  {
126  return new Levenshtein();
127  }
128 
134  public function utfnormal(): UTFNormal
135  {
136  return new UTFNormal();
137  }
138 
143  public function markdown(bool $escape = true): MarkdownFormattingToHTML
144  {
145  return new MarkdownFormattingToHTML($escape);
146  }
147 
151  public function encoding(): EncodingGroup
152  {
153  return new EncodingGroup();
154  }
155 }
__construct(Factory $dataFactory, \ILIAS\Language\Language $language)
Definition: Group.php:33
splitString(string $delimiter)
Creates a transformation that can be used to split a given string by given delimiter.
Definition: Group.php:69
Split a string by delimiter into array.
Definition: SplitString.php:32
Interface Observer Contains several chained tasks and infos about them.
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:60
markdown(bool $escape=true)
This method returns an instance of the MarkdownFormattingToHTML class which can be used to tranform a...
Definition: Group.php:143
utfnormal()
This method returns an instance of the UTFNormal class which can be used to get Transformations that ...
Definition: Group.php:134
levenshtein()
This method returns an instance of the Levenshtein class, to call the constructor of the LevenshteinT...
Definition: Group.php:124
caseOfLabel(string $language_key)
Creates a transformation that can be used to format a text for the title capitalization presentation ...
Definition: Group.php:89
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
makeClickable()
Creates a transformation to replace URL&#39;s like www.ilias.de to www.ilias.de.
Definition: Group.php:112
Builds data types.
Definition: Factory.php:35
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:47
encoding()
This method returns a group of string encoding transformations.
Definition: Group.php:151
stripTags()
Creates a transformation that strips tags from a string.
Definition: Group.php:79
estimatedReadingTime(bool $withImages=false)
Creates a transformation to determine the estimated reading time of a human adult (roughly 275 WPM) I...
Definition: Group.php:103
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...
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
ILIAS Language Language $language
Definition: Group.php:31