Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
PHP80Functions.php
001 <?php declare(strict_types=1);
002
003 /**
004 * @package s9e\TextFormatter
005 * @copyright Copyright (c) 2010-2022 The s9e authors
006 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
007 */
008 namespace s9e\TextFormatter\Configurator\RendererGenerators\PHP\XPathConvertor\Convertors;
009
010 class PHP80Functions extends AbstractConvertor
011 {
012 /**
013 * {@inheritdoc}
014 */
015 public function getMatchers(): array
016 {
017 $groups = 'Boolean:BooleanFunction:';
018
019 return [
020 $groups . 'Contains' => 'contains \\( ((?&String)) , ((?&String)) \\)',
021 $groups . 'EndsWith' => 'ends-with \\( ((?&String)) , ((?&String)) \\)',
022 $groups . 'NotContains' => 'not \\( contains \\( ((?&String)) , ((?&String)) \\) \\)',
023 $groups . 'NotEndsWith' => 'not \\( ends-with \\( ((?&String)) , ((?&String)) \\) \\)',
024 $groups . 'NotStartsWith' => 'not \\( starts-with \\( ((?&String)) , ((?&String)) \\) \\)',
025 $groups . 'StartsWith' => 'starts-with \\( ((?&String)) , ((?&String)) \\)'
026 ];
027 }
028
029 /**
030 * Convert a call to contains()
031 *
032 * @param string $haystack Expression for the haystack part of the call
033 * @param string $needle Expression for the needle part of the call
034 * @return string
035 */
036 public function parseContains(string $haystack, string $needle): string
037 {
038 return 'str_contains(' . $this->recurse($haystack) . ',' . $this->recurse($needle) . ')';
039 }
040
041 /**
042 * Convert a call to ends-with()
043 *
044 * @param string $string Expression for the string part of the call
045 * @param string $substring Expression for the substring part of the call
046 * @return string
047 */
048 public function parseEndsWith(string $string, string $substring): string
049 {
050 return 'str_ends_with(' . $this->recurse($string) . ',' . $this->recurse($substring) . ')';
051 }
052
053 /**
054 * Convert a call to not(contains())
055 *
056 * @param string $haystack Expression for the haystack part of the call
057 * @param string $needle Expression for the needle part of the call
058 * @return string
059 */
060 public function parseNotContains(string $haystack, string $needle): string
061 {
062 return '!str_contains(' . $this->recurse($haystack) . ',' . $this->recurse($needle) . ')';
063 }
064
065 /**
066 * Convert a call to not(ends-with())
067 *
068 * @param string $string Expression for the string part of the call
069 * @param string $substring Expression for the substring part of the call
070 * @return string
071 */
072 public function parseNotEndsWith(string $string, string $substring): string
073 {
074 return '!str_ends_with(' . $this->recurse($string) . ',' . $this->recurse($substring) . ')';
075 }
076
077 /**
078 * Convert a call to not(starts-with())
079 *
080 * @param string $string Expression for the string part of the call
081 * @param string $substring Expression for the substring part of the call
082 * @return string
083 */
084 public function parseNotStartsWith(string $string, string $substring): string
085 {
086 return '!str_starts_with(' . $this->recurse($string) . ',' . $this->recurse($substring) . ')';
087 }
088
089 /**
090 * Convert a call to starts-with()
091 *
092 * @param string $string Expression for the string part of the call
093 * @param string $substring Expression for the substring part of the call
094 * @return string
095 */
096 public function parseStartsWith(string $string, string $substring): string
097 {
098 return 'str_starts_with(' . $this->recurse($string) . ',' . $this->recurse($substring) . ')';
099 }
100 }