Code Duplication    Length = 18-18 lines in 6 locations

eZ/Publish/Core/REST/Client/ObjectStateService.php 2 locations

@@ 208-225 (lines=18) @@
205
     *
206
     * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
207
     */
208
    public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup)
209
    {
210
        $response = $this->client->request(
211
            'DELETE',
212
            $objectStateGroup->id,
213
            new Message(
214
                // @todo: What media-type should we set here? Actually, it should be
215
                // all expected exceptions + none? Or is "ObjectStateGroup" correct,
216
                // since this is what is to be expected by the resource
217
                // identified by the URL?
218
                array('Accept' => $this->outputVisitor->getMediaType('ObjectStateGroup'))
219
            )
220
        );
221
222
        if (!empty($response->body)) {
223
            $this->inputDispatcher->parse($response);
224
        }
225
    }
226
227
    /**
228
     * Creates a new object state in the given group.
@@ 326-343 (lines=18) @@
323
     *
324
     * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState
325
     */
326
    public function deleteObjectState(ObjectState $objectState)
327
    {
328
        $response = $this->client->request(
329
            'DELETE',
330
            $objectState->id,
331
            new Message(
332
                // @todo: What media-type should we set here? Actually, it should be
333
                // all expected exceptions + none? Or is "ObjectState" correct,
334
                // since this is what is to be expected by the resource
335
                // identified by the URL?
336
                array('Accept' => $this->outputVisitor->getMediaType('ObjectState'))
337
            )
338
        );
339
340
        if (!empty($response->body)) {
341
            $this->inputDispatcher->parse($response);
342
        }
343
    }
344
345
    /**
346
     * Sets the object-state of a state group to $state for the given content.

eZ/Publish/Core/REST/Client/SectionService.php 1 location

@@ 287-304 (lines=18) @@
284
     *
285
     * @param \eZ\Publish\API\Repository\Values\Content\Section $section
286
     */
287
    public function deleteSection(Section $section)
288
    {
289
        $response = $this->client->request(
290
            'DELETE',
291
            $section->id,
292
            new Message(
293
                // @todo: What media-type should we set here? Actually, it should be
294
                // all expected exceptions + none? Or is "Section" correct,
295
                // since this is what is to be expected by the resource
296
                // identified by the URL?
297
                array('Accept' => $this->outputVisitor->getMediaType('Section'))
298
            )
299
        );
300
301
        if (!empty($response->body)) {
302
            $this->inputDispatcher->parse($response);
303
        }
304
    }
305
306
    /**
307
     * Instantiates a new SectionCreateStruct.

eZ/Publish/Core/REST/Client/TrashService.php 2 locations

@@ 152-169 (lines=18) @@
149
     *
150
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to empty the trash
151
     */
152
    public function emptyTrash()
153
    {
154
        $response = $this->client->request(
155
            'DELETE',
156
            $this->requestParser->generate('trashItems'),
157
            new Message(
158
                // @todo: What media-type should we set here? Actually, it should be
159
                // all expected exceptions + none? Or is "Location" correct,
160
                // since this is what is to be expected by the resource
161
                // identified by the URL?
162
                array('Accept' => $this->outputVisitor->getMediaType('Location'))
163
            )
164
        );
165
166
        if (!empty($response->body)) {
167
            $this->inputDispatcher->parse($response);
168
        }
169
    }
170
171
    /**
172
     * Deletes a trash item.
@@ 180-197 (lines=18) @@
177
     *
178
     * @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem
179
     */
180
    public function deleteTrashItem(APITrashItem $trashItem)
181
    {
182
        $response = $this->client->request(
183
            'DELETE',
184
            $trashItem->id,
185
            new Message(
186
                // @todo: What media-type should we set here? Actually, it should be
187
                // all expected exceptions + none? Or is "Location" correct,
188
                // since this is what is to be expected by the resource
189
                // identified by the URL?
190
                array('Accept' => $this->outputVisitor->getMediaType('Location'))
191
            )
192
        );
193
194
        if (!empty($response->body)) {
195
            $this->inputDispatcher->parse($response);
196
        }
197
    }
198
199
    /**
200
     * Returns a collection of Trashed locations contained in the trash.

eZ/Publish/Core/REST/Client/RoleService.php 1 location

@@ 583-600 (lines=18) @@
580
     *
581
     * @param \eZ\Publish\API\Repository\Values\User\Role $role
582
     */
583
    public function deleteRole(APIRole $role)
584
    {
585
        $response = $this->client->request(
586
            'DELETE',
587
            $role->id,
588
            new Message(
589
                // @todo: What media-type should we set here? Actually, it should be
590
                // all expected exceptions + none? Or is "Section" correct,
591
                // since this is what is to be expected by the resource
592
                // identified by the URL?
593
                array('Accept' => $this->outputVisitor->getMediaType('Role'))
594
            )
595
        );
596
597
        if (!empty($response->body)) {
598
            $this->inputDispatcher->parse($response);
599
        }
600
    }
601
602
    /**
603
     * Loads all policies from roles which are assigned to a user or to user groups to which the user belongs.