Code Duplication    Length = 17-19 lines in 2 locations

src/Validation/JsonApi/Execution/JsonApiParserFactory.php 2 locations

@@ 60-76 (lines=17) @@
57
     *
58
     * @SuppressWarnings(PHPMD.StaticAccess)
59
     */
60
    public function createDataParser(string $rulesClass): JsonApiDataParserInterface
61
    {
62
        $serializedData = FluteSettings::getJsonDataSerializedRules($this->getFluteSettings());
63
64
        /** @var FormatterFactoryInterface $formatterFactory */
65
        $formatterFactory = $this->getContainer()->get(FormatterFactoryInterface::class);
66
        $parser           = new DataParser(
67
            $rulesClass,
68
            JsonApiDataRulesSerializer::class,
69
            $serializedData,
70
            new ContextStorage(JsonApiQueryRulesSerializer::readBlocks($serializedData), $this->getContainer()),
71
            new JsonApiErrorCollection($formatterFactory->createFormatter(Messages::NAMESPACE_NAME)),
72
            $this->getContainer()->get(FormatterFactoryInterface::class)
73
        );
74
75
        return $parser;
76
    }
77
78
    /**
79
     * @inheritdoc
@@ 83-101 (lines=19) @@
80
     *
81
     * @SuppressWarnings(PHPMD.StaticAccess)
82
     */
83
    public function createQueryParser(string $rulesClass): JsonApiQueryParserInterface
84
    {
85
        $serializedData = FluteSettings::getJsonQuerySerializedRules($this->getFluteSettings());
86
87
        /** @var FormatterFactoryInterface $formatterFactory */
88
        $formatterFactory = $this->getContainer()->get(FormatterFactoryInterface::class);
89
        $parser           = new QueryParser(
90
            $rulesClass,
91
            JsonApiQueryRulesSerializer::class,
92
            $serializedData,
93
            new ContextStorage(JsonApiQueryRulesSerializer::readBlocks($serializedData), $this->getContainer()),
94
            new CaptureAggregator(),
95
            new ErrorAggregator(),
96
            new JsonApiErrorCollection($formatterFactory->createFormatter(Messages::NAMESPACE_NAME)),
97
            $this->getContainer()->get(FormatterFactoryInterface::class)
98
        );
99
100
        return $parser;
101
    }
102
103
    /**
104
     * @return array