Code Duplication    Length = 5-6 lines in 2 locations

eZ/Publish/Core/MVC/Symfony/Controller/Content/DownloadController.php 1 location

@@ 57-61 (lines=5) @@
54
            $fieldIdentifier,
55
            $request->query->has('inLanguage') ? $request->query->get('inLanguage') : null
56
        );
57
        if (!$field instanceof Field) {
58
            throw new InvalidArgumentException(
59
                "'{$fieldIdentifier}' field not present on content #{$content->contentInfo->id} '{$content->contentInfo->name}'"
60
            );
61
        }
62
63
        $response = new BinaryStreamResponse($this->ioService->loadBinaryFile($field->value->id), $this->ioService);
64
        $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename);

eZ/Publish/Core/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php 1 location

@@ 123-128 (lines=6) @@
120
    public function renderField(Content $content, $fieldIdentifier, array $params = [])
121
    {
122
        $field = $this->translationHelper->getTranslatedField($content, $fieldIdentifier, isset($params['lang']) ? $params['lang'] : null);
123
        if (!$field instanceof Field) {
124
            throw new InvalidArgumentException(
125
                '$fieldIdentifier',
126
                "'{$fieldIdentifier}' field not present on content #{$content->contentInfo->id} '{$content->contentInfo->name}'"
127
            );
128
        }
129
130
        $params = $this->getRenderFieldBlockParameters($content, $field, $params);
131
        $fieldTypeIdentifier = $this->getFieldTypeIdentifier($content, $field);