23 private $childrenPrefixes = [];
28 private $childrenSuffixes = [];
33 private $childrenDelimiter = [];
42 if (empty($punctuationSign) || preg_match(
"/^\s+$/", $punctuationSign)) {
45 $pattern =
'/'.preg_quote(trim($punctuationSign)).
'{2,}/';
46 if (preg_match($pattern, $subject)) {
47 return preg_replace($pattern, $punctuationSign, $subject);
57 if (method_exists($child,
"renderPrefix")) {
58 if (!empty($child->renderPrefix()) && !in_array($child->renderPrefix(), $this->childrenPrefixes)) {
59 $this->childrenPrefixes[] = $child->renderPrefix();
62 if (method_exists($child,
"renderSuffix")) {
63 if (!empty($child->renderSuffix()) && !in_array($child->renderSuffix(), $this->childrenSuffixes)) {
64 $this->childrenSuffixes[] = $child->renderSuffix();
67 if (method_exists($child,
"getDelimiter")) {
68 if (!empty($child->getDelimiter()) && !in_array($child->getDelimiter(), $this->childrenDelimiter)) {
69 $this->childrenDelimiter[] = $child->getDelimiter();
80 foreach ($this->childrenPrefixes as $prefix) {
83 foreach ($this->childrenSuffixes as $suffix) {
86 foreach ($this->childrenDelimiter as $delimiter) {
90 $string = preg_replace(
"/\s{2,}/",
" ", $string);