Code Duplication    Length = 23-25 lines in 2 locations

htdocs/class/xoopsform/formelementtray.php 1 location

@@ 125-147 (lines=23) @@
122
     * @param  bool $recurse get elements recursively?
123
     * @return array Array of {@link XoopsFormElement} objects.
124
     */
125
    public function &getElements($recurse = false)
126
    {
127
        if (!$recurse) {
128
            return $this->_elements;
129
        } else {
130
            $ret   = array();
131
            $count = count($this->_elements);
132
            for ($i = 0; $i < $count; ++$i) {
133
                if (!$this->_elements[$i]->isContainer()) {
134
                    $ret[] = &$this->_elements[$i];
135
                } else {
136
                    $elements = &$this->_elements[$i]->getElements(true);
137
                    $count2   = count($elements);
138
                    for ($j = 0; $j < $count2; ++$j) {
139
                        $ret[] = &$elements[$j];
140
                    }
141
                    unset($elements);
142
                }
143
            }
144
145
            return $ret;
146
        }
147
    }
148
149
    /**
150
     * Get the delimiter of this group

htdocs/class/xoopsform/form.php 1 location

@@ 324-348 (lines=25) @@
321
     *
322
     * @return array array of {@link XoopsFormElement}s
323
     */
324
    public function &getElements($recurse = false)
325
    {
326
        if (!$recurse) {
327
            return $this->_elements;
328
        } else {
329
            $ret   = array();
330
            $count = count($this->_elements);
331
            for ($i = 0; $i < $count; ++$i) {
332
                if (is_object($this->_elements[$i])) {
333
                    if (!$this->_elements[$i]->isContainer()) {
334
                        $ret[] = &$this->_elements[$i];
335
                    } else {
336
                        $elements = &$this->_elements[$i]->getElements(true);
337
                        $count2   = count($elements);
338
                        for ($j = 0; $j < $count2; ++$j) {
339
                            $ret[] = &$elements[$j];
340
                        }
341
                        unset($elements);
342
                    }
343
                }
344
            }
345
346
            return $ret;
347
        }
348
    }
349
350
    /**
351
     * get an array of "name" attributes of form elements