Code Duplication    Length = 19-21 lines in 2 locations

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

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

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.