Code Duplication    Length = 12-14 lines in 15 locations

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

@@ 103-116 (lines=14) @@
100
     *
101
     * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo
102
     */
103
    public function loadContentInfo($contentId)
104
    {
105
        $response = $this->client->request(
106
            'GET',
107
            $contentId,
108
            new Message(
109
                array('Accept' => $this->outputVisitor->getMediaType('ContentInfo'))
110
            )
111
        );
112
113
        $restContentInfo = $this->inputDispatcher->parse($response);
114
115
        return $this->completeContentInfo($restContentInfo);
116
    }
117
118
    /**
119
     * Loads a content info object for the given remoteId.

eZ/Publish/Core/REST/Client/ContentTypeService.php 7 locations

@@ 121-132 (lines=12) @@
118
    /**
119
     * {@inheritdoc}.
120
     */
121
    public function loadContentTypeGroup($contentTypeGroupId, array $prioritizedLanguages = [])
122
    {
123
        $response = $this->client->request(
124
            'GET',
125
            $contentTypeGroupId,
126
            new Message(
127
                array('Accept' => $this->outputVisitor->getMediaType('Section'))
128
            )
129
        );
130
131
        return $this->inputDispatcher->parse($response);
132
    }
133
134
    /**
135
     * {@inheritdoc}.
@@ 163-174 (lines=12) @@
160
    /**
161
     * {@inheritdoc}.
162
     */
163
    public function loadContentTypeGroups(array $prioritizedLanguages = [])
164
    {
165
        $response = $this->client->request(
166
            'GET',
167
            $this->requestParser->generate('typegroups'),
168
            new Message(
169
                array('Accept' => $this->outputVisitor->getMediaType('ContentTypeGroupList'))
170
            )
171
        );
172
173
        return $this->inputDispatcher->parse($response);
174
    }
175
176
    /**
177
     * Update a Content Type Group object.
@@ 375-386 (lines=12) @@
372
     *
373
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
374
     */
375
    public function loadContentTypeDraft($contentTypeId)
376
    {
377
        $response = $this->client->request(
378
            'GET',
379
            $contentTypeId,
380
            new Message(
381
                array('Accept' => $this->outputVisitor->getMediaType('ContentType'))
382
            )
383
        );
384
385
        return $this->inputDispatcher->parse($response);
386
    }
387
388
    /**
389
     * Update a Content Type object.
@@ 474-485 (lines=12) @@
471
    /**
472
     * {@inheritdoc}.
473
     */
474
    public function loadContentType($contentTypeId, array $prioritizedLanguages = [])
475
    {
476
        $response = $this->client->request(
477
            'GET',
478
            $contentTypeId,
479
            new Message(
480
                array('Accept' => $this->outputVisitor->getMediaType('ContentType'))
481
            )
482
        );
483
484
        return $this->completeContentType($this->inputDispatcher->parse($response));
485
    }
486
487
    /**
488
     * Loads a single field definition by $fieldDefinitionId.
@@ 497-508 (lines=12) @@
494
     *
495
     * @return FieldDefinition
496
     */
497
    public function loadFieldDefinition($fieldDefinitionId)
498
    {
499
        $response = $this->client->request(
500
            'GET',
501
            $fieldDefinitionId,
502
            new Message(
503
                array('Accept' => $this->outputVisitor->getMediaType('FieldDefinition'))
504
            )
505
        );
506
507
        return $this->inputDispatcher->parse($response);
508
    }
509
510
    /**
511
     * Loads the FieldDefinitionList stored at $fieldDefinitionListReference.
@@ 520-531 (lines=12) @@
517
     *
518
     * @return \eZ\Publish\Core\REST\Client\Values\FieldDefinitionList
519
     */
520
    public function loadFieldDefinitionList($fieldDefinitionListReference)
521
    {
522
        $response = $this->client->request(
523
            'GET',
524
            $fieldDefinitionListReference,
525
            new Message(
526
                array('Accept' => $this->outputVisitor->getMediaType('FieldDefinitionList'))
527
            )
528
        );
529
530
        return $this->inputDispatcher->parse($response);
531
    }
532
533
    /**
534
     * Loads the ContentTypeGroupList stored at $contentTypeGroupListReference.
@@ 543-554 (lines=12) @@
540
     *
541
     * @return \eZ\Publish\Core\REST\Client\Values\ContentTypeGroupRefList
542
     */
543
    public function loadContentTypeGroupList($contentTypeGroupListReference)
544
    {
545
        $response = $this->client->request(
546
            'GET',
547
            $contentTypeGroupListReference,
548
            new Message(
549
                array('Accept' => $this->outputVisitor->getMediaType('ContentTypeGroupRefList'))
550
            )
551
        );
552
553
        return $this->inputDispatcher->parse($response);
554
    }
555
556
    /**
557
     * {@inheritdoc}.

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

@@ 133-144 (lines=12) @@
130
     *
131
     * @return \eZ\Publish\API\Repository\Values\Content\Location
132
     */
133
    public function loadLocation($locationId)
134
    {
135
        $response = $this->client->request(
136
            'GET',
137
            $locationId,
138
            new Message(
139
                array('Accept' => $this->outputVisitor->getMediaType('Location'))
140
            )
141
        );
142
143
        return $this->inputDispatcher->parse($response);
144
    }
145
146
    /**
147
     * Loads a location object from its $remoteId.

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

@@ 114-125 (lines=12) @@
111
     *
112
     * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
113
     */
114
    public function loadObjectStateGroup($objectStateGroupId)
115
    {
116
        $response = $this->client->request(
117
            'GET',
118
            $objectStateGroupId,
119
            new Message(
120
                array('Accept' => $this->outputVisitor->getMediaType('ObjectStateGroup'))
121
            )
122
        );
123
124
        return $this->inputDispatcher->parse($response);
125
    }
126
127
    /**
128
     * Loads all object state groups.
@@ 262-273 (lines=12) @@
259
     *
260
     * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState
261
     */
262
    public function loadObjectState($stateId)
263
    {
264
        $response = $this->client->request(
265
            'GET',
266
            $stateId,
267
            new Message(
268
                array('Accept' => $this->outputVisitor->getMediaType('ObjectState'))
269
            )
270
        );
271
272
        return $this->inputDispatcher->parse($response);
273
    }
274
275
    /**
276
     * Updates an object state.

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

@@ 561-572 (lines=12) @@
558
     *
559
     * @return \eZ\Publish\API\Repository\Values\User\Role[]
560
     */
561
    public function loadRoles()
562
    {
563
        $response = $this->client->request(
564
            'GET',
565
            $this->requestParser->generate('roles'),
566
            new Message(
567
                array('Accept' => $this->outputVisitor->getMediaType('RoleList'))
568
            )
569
        );
570
571
        return $this->inputDispatcher->parse($response);
572
    }
573
574
    /**
575
     * Deletes the given role.

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

@@ 153-164 (lines=12) @@
150
     *
151
     * @return \eZ\Publish\API\Repository\Values\Content\Section
152
     */
153
    public function loadSection($sectionId)
154
    {
155
        $response = $this->client->request(
156
            'GET',
157
            $sectionId,
158
            new Message(
159
                array('Accept' => $this->outputVisitor->getMediaType('Section'))
160
            )
161
        );
162
163
        return $this->inputDispatcher->parse($response);
164
    }
165
166
    /**
167
     * Loads all sections.
@@ 173-184 (lines=12) @@
170
     *
171
     * @return array of {@link \eZ\Publish\API\Repository\Values\Content\Section}
172
     */
173
    public function loadSections()
174
    {
175
        $response = $this->client->request(
176
            'GET',
177
            $this->requestParser->generate('sections'),
178
            new Message(
179
                array('Accept' => $this->outputVisitor->getMediaType('SectionList'))
180
            )
181
        );
182
183
        return $this->inputDispatcher->parse($response);
184
    }
185
186
    /**
187
     * Loads a Section from its identifier ($sectionIdentifier).

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

@@ 94-107 (lines=14) @@
91
     *
92
     * @return \eZ\Publish\API\Repository\Values\Content\TrashItem
93
     */
94
    public function loadTrashItem($trashItemId)
95
    {
96
        $response = $this->client->request(
97
            'GET',
98
            $trashItemId,
99
            new Message(
100
                array('Accept' => $this->outputVisitor->getMediaType('Location'))
101
            )
102
        );
103
104
        $location = $this->inputDispatcher->parse($response);
105
106
        return $this->buildTrashItem($location);
107
    }
108
109
    /**
110
     * Sends $location and all its children to trash and returns the corresponding trash item.