Code Duplication    Length = 3-3 lines in 2 locations

src/Serializer/SerializerContextBuilder.php 1 location

@@ 41-43 (lines=3) @@
38
     */
39
    public function createFromRequest(Request $request, bool $normalization, array $attributes = null): array
40
    {
41
        if (null === $attributes && !$attributes = RequestAttributesExtractor::extractAttributes($request)) {
42
            throw new RuntimeException('Request attributes are not valid.');
43
        }
44
45
        $resourceMetadata = $this->resourceMetadataFactory->create($attributes['resource_class']);
46
        $key = $normalization ? 'normalization_context' : 'denormalization_context';

src/Serializer/SerializerFilterContextBuilder.php 1 location

@@ 46-48 (lines=3) @@
43
     */
44
    public function createFromRequest(Request $request, bool $normalization, array $attributes = null): array
45
    {
46
        if (null === $attributes && !$attributes = RequestAttributesExtractor::extractAttributes($request)) {
47
            throw new RuntimeException('Request attributes are not valid.');
48
        }
49
50
        $context = $this->decorated->createFromRequest($request, $normalization, $attributes);
51
        $resourceMetadata = $this->resourceMetadataFactory->create($attributes['resource_class']);