Code Duplication    Length = 15-15 lines in 2 locations

eZ/Publish/Core/REST/Common/Output/Generator.php 2 locations

@@ 113-127 (lines=15) @@
110
     *
111
     * @param mixed $data
112
     */
113
    protected function checkStartObjectElement($data)
114
    {
115
        $this->checkStart('objectElement', $data, array('document', 'objectElement', 'hashElement', 'list'));
116
117
        $last = count($this->stack) - 2;
118
        if ($this->stack[$last][0] !== 'list') {
119
            // Ensure object element type only occurs once outside of lists
120
            if (isset($this->stack[$last][2][$data])) {
121
                throw new Exceptions\OutputGeneratorException(
122
                    "Element {$data} may only occur once inside of {$this->stack[$last][0]}."
123
                );
124
            }
125
        }
126
        $this->stack[$last][2][$data] = true;
127
    }
128
129
    /**
130
     * End object element.
@@ 158-172 (lines=15) @@
155
     *
156
     * @param mixed $data
157
     */
158
    protected function checkStartHashElement($data)
159
    {
160
        $this->checkStart('hashElement', $data, array('document', 'objectElement', 'hashElement', 'list'));
161
162
        $last = count($this->stack) - 2;
163
        if ($this->stack[$last][0] !== 'list') {
164
            // Ensure hash element type only occurs once outside of lists
165
            if (isset($this->stack[$last][2][$data])) {
166
                throw new Exceptions\OutputGeneratorException(
167
                    "Element {$data} may only occur once inside of {$this->stack[$last][0]}."
168
                );
169
            }
170
        }
171
        $this->stack[$last][2][$data] = true;
172
    }
173
174
    /**
175
     * End hash element.