QueryPath\Entities::doReplacement PHP Метод

doReplacement() защищенный статический Метод

Callback for processing replacements.
protected static doReplacement ( array $matches )
$matches array The regular expression replacement array.
    protected static function doReplacement($matches)
    {
        // See how the regex above works out.
        //print_r($matches);
        // From count, we can tell whether we got a
        // char, num, or bare ampersand.
        $count = count($matches);
        switch ($count) {
            case 2:
                // We have a character entity
                return '&#' . self::replaceEntity($matches[1]) . ';';
            case 3:
            case 4:
                // we have a numeric entity
                return '&#' . $matches[$count - 1] . ';';
            case 5:
                // We have an unescaped ampersand.
                return '&';
        }
    }