Code Duplication    Length = 18-18 lines in 6 locations

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, which are readable by the current user.

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

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

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

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

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

@@ 188-205 (lines=18) @@
185
     *
186
     * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
187
     */
188
    public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup)
189
    {
190
        $response = $this->client->request(
191
            'DELETE',
192
            $objectStateGroup->id,
193
            new Message(
194
                // @todo: What media-type should we set here? Actually, it should be
195
                // all expected exceptions + none? Or is "ObjectStateGroup" correct,
196
                // since this is what is to be expected by the resource
197
                // identified by the URL?
198
                array('Accept' => $this->outputVisitor->getMediaType('ObjectStateGroup'))
199
            )
200
        );
201
202
        if (!empty($response->body)) {
203
            $this->inputDispatcher->parse($response);
204
        }
205
    }
206
207
    /**
208
     * Creates a new object state in the given group.
@@ 300-317 (lines=18) @@
297
     *
298
     * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState
299
     */
300
    public function deleteObjectState(ObjectState $objectState)
301
    {
302
        $response = $this->client->request(
303
            'DELETE',
304
            $objectState->id,
305
            new Message(
306
                // @todo: What media-type should we set here? Actually, it should be
307
                // all expected exceptions + none? Or is "ObjectState" correct,
308
                // since this is what is to be expected by the resource
309
                // identified by the URL?
310
                array('Accept' => $this->outputVisitor->getMediaType('ObjectState'))
311
            )
312
        );
313
314
        if (!empty($response->body)) {
315
            $this->inputDispatcher->parse($response);
316
        }
317
    }
318
319
    /**
320
     * Sets the object-state of a state group to $state for the given content.