Code Duplication    Length = 8-8 lines in 3 locations

htdocs/class/model/joint.php 1 location

@@ 83-90 (lines=8) @@
80
            return null;
81
        }
82
83
        if (is_array($fields) && count($fields)) {
84
            if (!in_array('o.' . $this->handler->keyName, $fields)) {
85
                $fields[] = 'o.' . $this->handler->keyName;
86
            }
87
            $select = implode(',', $fields);
88
        } else {
89
            $select = 'o.*, l.*';
90
        }
91
        $limit = null;
92
        $start = null;
93
        // $field_object = empty($field_object) ? $field_link : $field_object;

htdocs/class/model/read.php 1 location

@@ 42-49 (lines=8) @@
39
     */
40
    public function &getAll(CriteriaElement $criteria = null, $fields = null, $asObject = true, $id_as_key = true)
41
    {
42
        if (is_array($fields) && count($fields) > 0) {
43
            if (!in_array($this->handler->keyName, $fields)) {
44
                $fields[] = $this->handler->keyName;
45
            }
46
            $select = '`' . implode('`, `', $fields) . '`';
47
        } else {
48
            $select = '*';
49
        }
50
        $limit = null;
51
        $start = null;
52
        $sql   = "SELECT {$select} FROM `{$this->handler->table}`";

htdocs/kernel/object.php 1 location

@@ 1347-1354 (lines=8) @@
1344
1345
            return $object;
1346
        }
1347
        if (is_array($fields) && count($fields) > 0) {
1348
            $select = implode(',', $fields);
1349
            if (!in_array($this->keyName, $fields)) {
1350
                $select .= ', ' . $this->keyName;
1351
            }
1352
        } else {
1353
            $select = '*';
1354
        }
1355
        $sql = sprintf('SELECT %s FROM %s WHERE %s = %s', $select, $this->table, $this->keyName, $this->db->quote($id));
1356
        //$sql = "SELECT {$select} FROM {$this->table} WHERE {$this->keyName} = " . $this->db->quote($id);
1357
        if (!$result = $this->db->query($sql)) {