MCPcopy Create free account
hub / github.com/Rello/analytics / replaceDatasourceText

Method replaceDatasourceText

lib/Service/VariableService.php:138–151  ·  view source on GitHub ↗

* Replace date variables embedded in data source text, such as file paths. * * @param string $text * @return string */

(string $text)

Source from the content-addressed store, hash-verified

136 * @return string
137 */
138 public function replaceDatasourceText(string $text): string {
139 return preg_replace_callback(
140 '/%[^%]+%(?:\([^)]*\))?/',
141 function (array $match): string {
142 $parsed = $this->parseFilter($match[0]);
143 if (!$parsed || is_array($parsed['value'])) {
144 return $match[0];
145 }
146
147 return date($this->parseFormat($match[0]), $parsed['value']);
148 },
149 $text
150 );
151 }
152
153 /**
154 * replace variables in filters and apply format

Calls 2

parseFilterMethod · 0.95
parseFormatMethod · 0.95