Code Duplication    Length = 19-21 lines in 2 locations

eZ/Publish/Core/REST/Server/Controller/ContentType.php 1 location

@@ 156-176 (lines=21) @@
153
     *
154
     * @return \eZ\Publish\Core\REST\Server\Values\ContentTypeGroupList
155
     */
156
    public function loadContentTypeGroupList(Request $request)
157
    {
158
        if ($request->query->has('identifier')) {
159
            $contentTypeGroup = $this->contentTypeService->loadContentTypeGroupByIdentifier(
160
                $request->query->get('identifier')
161
            );
162
163
            return new Values\TemporaryRedirect(
164
                $this->router->generate(
165
                    'ezpublish_rest_loadContentTypeGroup',
166
                    array(
167
                        'contentTypeGroupId' => $contentTypeGroup->id,
168
                    )
169
                )
170
            );
171
        }
172
173
        return new Values\ContentTypeGroupList(
174
            $this->contentTypeService->loadContentTypeGroups()
175
        );
176
    }
177
178
    /**
179
     * Returns the content type group given by id.

eZ/Publish/Core/REST/Server/Controller/Content.php 1 location

@@ 40-58 (lines=19) @@
37
     *
38
     * @return \eZ\Publish\Core\REST\Server\Values\TemporaryRedirect
39
     */
40
    public function redirectContent(Request $request)
41
    {
42
        if (!$request->query->has('remoteId')) {
43
            throw new BadRequestException("'remoteId' parameter is required.");
44
        }
45
46
        $contentInfo = $this->repository->getContentService()->loadContentInfoByRemoteId(
47
            $request->query->get('remoteId')
48
        );
49
50
        return new Values\TemporaryRedirect(
51
            $this->router->generate(
52
                'ezpublish_rest_loadContent',
53
                array(
54
                    'contentId' => $contentInfo->id,
55
                )
56
            )
57
        );
58
    }
59
60
    /**
61
     * Loads a content info, potentially with the current version embedded.