@todo locales handling in Application class

@param unknown $matches
557045
private function translatePhraseCallback($matches) {

		return 'xxxx';

		if(!empty($GLOBALS['phrases'][$config->site->current_locale][$matches[1]])) {
			return $GLOBALS['phrases'][$config->site->current_locale][$matches[1]];
		}

		if(isset($matches[3])) {
			return $this->storePhrase($matches[3], $matches[1]);
		}
		else {
			return $this->storePhrase($matches[1]);
		}
	}
836984
protected function parseDocReturn( $matches )
	{
		$return	= new ADT_PHP_Return( trim( $matches[1] ) );
		if( isset( $matches[2] ) )
			$return->setDescription( trim( $matches[2] ) );
		return $return;
	}
1328041
private function applyOrdering($matches)
    {
        foreach ($this->ordering as $ordering) {
            usort(
                $matches,
                function ($aRow, $bRow) use ($ordering) {
                    $a = $aRow[$ordering['column']];
                    $b = $bRow[$ordering['column']];

                    return $ordering['direction'] * ($a == $b ? 0 : ($a < $b ? -1 : 1));
                }
            );
        }

        return $matches;
    }
1017042
private static function cssMatcher($matches) {

        $chr = $matches[0];

        if(1 === strlen($chr)) {
            $ord = ord($chr);
        }
        else {
            
            $chr = static :: convert($chr, 'UTF-8', 'UTF-32BE');
            $ord = hexdec(bin2hex($chr));
        }

        return sprintf('\\%X ', $ord);
    }
1302031
protected function removeNumericAndEmpty(array &$matches)
    {
        foreach ($matches as $idx => $val) {
            if (is_int($idx) || '' === $val) {
                unset($matches[$idx]);
            }
        }
    }
208090
private function _interpolateCallback($matches)
	{
		$key = $matches[1];

		if (!isset($this->_interpolate[$key]))
		{
			throw new Exception(sprintf(
				"%s route needs '%s' value for '%s'",
				$this->_name,
				$key,
				$this->_template
			));
		}

		// percent encoding as per section 3.2 of URI Templates draft 9 July 2007,
		// and section 2.1 of http://www.faqs.org/rfcs/rfc3986
		return rawurlencode($this->_interpolate[$key]);
	}
197740
protected function _replaceParamsCallback($matches)
    {
        $key    = substr($matches[0], 1);
        $prefix = '';

        if(in_array($this->show, array('FULL TABLES', 'OPEN TABLES', 'TABLE STATUS', 'TABLES')) &&
            ($this->like && $key == 'like' || $this->where && ($key == 'name' || $key == 'table')))
        {
            $prefix = $this->getDriver()->getTablePrefix();
        }

        $replacement = $this->getDriver()->quoteValue($prefix.$this->_parameters[$key]);

        return is_array($this->_parameters[$key]) ? '('.$replacement.')' : $replacement;
    }
386246
private function _filter(array $matches)
    {
        $filters = explode('|', $matches[0]);
        $var = $filters[0];
        unset($filters[0]);
        foreach ($filters as $filter) {
            $params = explode(':', $filter);
            $filterName = $params[0];
            unset($params[0]);
            $array = 'array(';
            foreach ($params as $param) {
                $array .= $param . ',';
            }
            $array = trim($array, ',') . ')';
            $var = 'getFilter(\'' . $filterName . '\')->setOptions(' . $array . ')->filter(' . $var . ')';
        }
        return $var;
    }
140718
protected function decodeMatches(array $matches): string
    {
        if (1 === preg_match(static::REGEXP_PREVENTS_DECODING, $matches[0])) {
            return strtoupper($matches[0]);
        }

        return rawurldecode($matches[0]);
    }
217155
private static function jsMatcher($matches) {

        $chr = $matches[0];

        if(1 === strlen($chr)) {
            return sprintf('\\x%02X', ord($chr));
        }

        $chr = static :: convert($chr, 'UTF-8', 'UTF-16BE');
        $hex = strtoupper(bin2hex($chr));

        if(strlen($hex) <= 4) {
            return sprintf('\\u%04s', $hex);
        }

        return sprintf('\\u%04s\\u%04s', substr($hex, 0, 4), substr($hex, 4, 4));
    }
581318
private function computeUrlRegex(array $matches)
    {
        $this->names[] = $matches[1];

        if (isset($this->conditions[$matches[1]])) {
            return '(?P<' . $matches[1] . '>' . $this->conditions[$matches[1]] . ')';
        }

        if (substr($matches[0], -1) === '+') {

            $this->namesPath[$matches[1]] = 1;

            return '(?P<' . $matches[1] . '>.+)';
        }

        return '(?P<' . $matches[1] . '>[^/]+)';
    }
1318504
protected function literal(array $matches)
    {
        // hash from matches
        $hash = '[!' . __FUNCTION__ . '::read(' . \crc32($matches[1]) . ')!]';

        // save hash and value to literals array
        $this->literals[$hash] = $matches[1];

        // return hash value for replace
        return $hash;
    }
831740
private static function quickTempCallback($matches)
	{
		for ($i=1, $count=\count($matches); $i<$count; $i++) {
			if (\strlen($matches[$i])) {
				$key = $matches[$i];
				break;
			}
		}
		$return = null;
		if (\substr($matches[0], 0, 1) == '\\') {
			$return = \ltrim($matches[0], '\\');
		} elseif (\is_array(self::$temp)) {
			$arrayUtil = new ArrayUtil();
			$return = $arrayUtil->path(self::$temp, $key);
		} elseif (\is_object(self::$temp) && isset(self::$temp->$key)) {
			$return = self::$temp->$key;
		}
		if ($return === null) {
			#$this->debug->log('try lookup func');
			$regex = '/^(\S+?)(?:'	// key
					.'\((.+)\)|'	// (param1, ...)
					.'\s+((?:[\'"\$]|array|true|false|null).*)$'	// params not inside parens
				.')/s';
			if (\preg_match($regex, $key, $matches)) {
				#$this->debug->log('func()');
				$args = !empty($matches[2])
					? $matches[2]
					: $matches[3];
				$key = $matches[1];
				$parsed = @eval('$args = array('.$args.');');
				if ($parsed === false) {
					// workaround for PHP "Bug" that sends a 500 response when an eval doesn't parse
					$code = !empty($_SERVER['REDIRECT_STATUS'])
						? $_SERVER['REDIRECT_STATUS']
						: 200;
					\header('Status:', true, $code);
				}
			} else {
				#$this->debug->log('unquoted string arg');
				$args	= \explode(' ', $key, 2);
				$key	= \array_shift($args);
			}
			#$this->debug->log('args', $args);
			if (is_object(self::$temp) && method_exists(self::$temp, 'get'.\ucfirst($key))) {
				$method = 'get'.\ucfirst($key);
				#$this->debug->info('method exists', $method);
				$return = \call_user_func_array(array(self::$temp, $method), $args);
			} elseif (\function_exists('get_'.$key) && !\in_array($key, array('class'))) {
				$return = \call_user_func_array('get_'.$key, $args);
			} else {
				#$this->debug->warn('no method or get_ function');
			}
		}
		#$this->debug->info('return', $return);
		return $return;
	}
131072
public function setMatches($matches)
    {
        foreach ($matches as $key => $dtoData) {
            $this->matches[$key] = new MatchReferenceDto($dtoData);
        }
    
        return $this;
    }
661591
private function getNamedPatterns($matches)
    {
        foreach ($matches as $key => $value) {
            if (!is_string($key) || strlen($value) < 1) {
                unset($matches[$key]);
            }
        }

        return $matches;
    }
1069553
protected function _replaceTags($matches)
    {
        $style = $this->styles($matches['tag']);
        if (empty($style)) {
            return '<' . $matches['tag'] . '>' . $matches['text'] . '</' . $matches['tag'] . '>';
        }

        $styleInfo = [];
        if (!empty($style['text']) && isset(static::$_foregroundColors[$style['text']])) {
            $styleInfo[] = static::$_foregroundColors[$style['text']];
        }
        if (!empty($style['background']) && isset(static::$_backgroundColors[$style['background']])) {
            $styleInfo[] = static::$_backgroundColors[$style['background']];
        }
        unset($style['text'], $style['background']);
        foreach ($style as $option => $value) {
            if ($value) {
                $styleInfo[] = static::$_options[$option];
            }
        }

        return "\033[" . implode($styleInfo, ';') . 'm' . $matches['text'] . "\033[0m";
    }
1055704
public function convertToRegex($matches)
    {
        $key = str_replace(':', '', $matches[0]);
        if (array_key_exists($key, $this->conditions)) {
            return '(' . $this->conditions[$key] . ')';
        } else {
            return '([a-zA-Z0-9_\-\.]+)';
        }
    }