Code Duplication    Length = 10-14 lines in 2 locations

src/CommandExtractor/JMSSerializerCommandExtractor.php 1 location

@@ 37-50 (lines=14) @@
34
     * {@inheritdoc}
35
     * @throws \LogicException
36
     */
37
    public function extractFromRequest(Request $request, string $commandClass, array $additionalProps = [])
38
    {
39
        if (!empty($additionalProps)) {
40
            $decodedContent = $this->jmsSerializer->deserialize(
41
                $request->getContent(),
42
                'array',
43
                $request->getRequestFormat()
44
            );
45
            $finalProps = array_merge($decodedContent, $additionalProps);
46
            return $this->jmsArrayTransformer->fromArray($finalProps, $commandClass);
47
        }
48
49
        return $this->jmsSerializer->deserialize($request->getContent(), $commandClass, $request->getRequestFormat());
50
    }
51
}
52

src/CommandExtractor/SerializerCommandExtractor.php 1 location

@@ 49-58 (lines=10) @@
46
     * @throws \LogicException
47
     * @throws \Symfony\Component\Serializer\Exception\UnexpectedValueException
48
     */
49
    public function extractFromRequest(Request $request, string $commandClass, array $additionalProps = [])
50
    {
51
        if (!empty($additionalProps)) {
52
            $decodedContent = $this->decoder->decode($request->getContent(), $request->getRequestFormat());
53
            $finalProps = array_merge($decodedContent, $additionalProps);
54
            return $this->denormalizer->denormalize($finalProps, $commandClass, $request->getRequestFormat());
55
        }
56
57
        return $this->serializer->deserialize($request->getContent(), $commandClass, $request->getRequestFormat());
58
    }
59
}
60