Code Duplication    Length = 17-17 lines in 2 locations

src/Entity/Request.php 2 locations

@@ 153-169 (lines=17) @@
150
     * @param Item $item
151
     * @return $this
152
     */
153
    public function addItem(Item $item)
154
    {
155
        // Check for unique identifier
156
        if (array_key_exists($item->getItemIdentifier(), $this->items)) {
157
            throw new CriticalException('Identifier already exists');
158
        }
159
160
        // Check if we can validate it
161
        if (!$item->validate()) {
162
            throw new CriticalException('Cannot validate item settings, item: ' . print_r($item->render(), true));
163
        }
164
165
        // Add to store
166
        $this->items[$item->getItemIdentifier()] = $item;
167
168
        return $this;
169
    }
170
171
    /**
172
     * @param Bin $bin
@@ 175-191 (lines=17) @@
172
     * @param Bin $bin
173
     * @return $this
174
     */
175
    public function addBin(Bin $bin)
176
    {
177
        // Check for unique identifier
178
        if (array_key_exists($bin->getIdentifier(), $this->bins)) {
179
            throw new CriticalException('Identifier already exists');
180
        }
181
182
        // Check if we can validate it
183
        if (!$bin->validate()) {
184
            throw new CriticalException('Cannot validate bin settings, bin: ' . print_r($bin->render(), true));
185
        }
186
187
        // Add to store
188
        $this->bins[$bin->getIdentifier()] = $bin;
189
190
        return $this;
191
    }
192
193
    /**
194
     * @return array