Code Duplication    Length = 6-6 lines in 2 locations

system/Inji/Model.php 1 location

@@ 181-186 (lines=6) @@
178
        switch ($type) {
179
            case 'autocomplete':
180
                $options = $colInfo['colParams']['options'];
181
                if (isset($options['snippet']) && is_string($options['snippet'])) {
182
                    $snippets = \App::$cur->Ui->getSnippets('autocomplete');
183
                    if (isset($snippets[$options['snippet']])) {
184
                        $value = $snippets[$options['snippet']]['getValueText']($item->$colName, $options['snippetParams']);
185
                    }
186
                }
187
                break;
188
            case 'select':
189
                switch ($colInfo['colParams']['source']) {

system/modules/Ui/widgets/Form/autocomplete.php 1 location

@@ 8-13 (lines=6) @@
5
echo $label !== false ? "<label>{$label}</label>" : '';
6
$value = !empty($options['value']) ? addcslashes($options['value'], "'") : (!empty($form->userDataTree[$name]) ? addcslashes($form->userDataTree[$name], "'") : '');
7
$displayValue = '';
8
if ($value && isset($options['snippet']) && is_string($options['snippet'])) {
9
    $snippets = App::$cur->Ui->getSnippets('autocomplete');
10
    if (isset($snippets[$options['snippet']])) {
11
        $displayValue = $snippets[$options['snippet']]['getValueText']($value, $options['snippetParams']);
12
    }
13
}
14
?>
15
<input <?= !empty($options['required']) ? 'required' : ''; ?>
16
        id='<?= $id; ?>'