Code Duplication    Length = 10-10 lines in 2 locations

htdocs/class/smarty/Smarty_Compiler.class.php 1 location

@@ 1177-1186 (lines=10) @@
1174
            return $this->_syntax_error("foreach: 'item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
1175
        }
1176
1177
        if (isset($attrs['key'])) {
1178
            $key  = $this->_dequote($attrs['key']);
1179
            if (!preg_match('~^\w+$~', $key)) {
1180
                return $this->_syntax_error("foreach: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
1181
            }
1182
            $key_part = "\$this->_tpl_vars['$key'] => ";
1183
        } else {
1184
            $key = null;
1185
            $key_part = '';
1186
        }
1187
1188
        if (isset($attrs['name'])) {
1189
            $name = $attrs['name'];

htdocs/class/smarty/xoops_plugins/compiler.foreachq.php 1 location

@@ 67-76 (lines=10) @@
64
        return $comp->_syntax_error("'foreachq: item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
65
    }
66
67
    if (isset($attrs['key'])) {
68
        $key = $comp->_dequote($attrs['key']);
69
        if (!preg_match('~^\w+$~', $key)) {
70
            return $comp->_syntax_error("foreachq: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
71
        }
72
        $key_part = "\$this->_tpl_vars['$key'] => ";
73
    } else {
74
        $key      = null;
75
        $key_part = '';
76
    }
77
78
    $name = null;
79
    if (isset($attrs['name'])) {