Code Duplication    Length = 21-21 lines in 2 locations

src/Mapper/Definition/ConfigurationProcessor/AttributeProcessor.php 1 location

@@ 95-115 (lines=21) @@
92
     * @param string    $definition
93
     * @param Attribute $attribute
94
     */
95
    protected function processDataType(string $definition, Attribute $attribute)
96
    {
97
        if (! preg_match(self::DATATYPE_PATTERN, $definition, $matches)) {
98
            throw new \LogicException(sprintf('Data-type definition "%s" is invalid.', $definition));
99
        }
100
101
        $attribute->setType($matches['type']);
102
103
        if (! empty($matches['many'])) {
104
            $attribute->setMany();
105
        }
106
107
        if (empty($matches['params'])) {
108
            return;
109
        }
110
111
        $parameters = explode(',', $matches['params']);
112
        $parameters = array_map('trim', $parameters);
113
114
        $attribute->setTypeParameters($parameters);
115
    }
116
}

src/Mapper/Definition/AnnotationProcessor/AttributeProcessor.php 1 location

@@ 210-230 (lines=21) @@
207
     * @param string    $definition
208
     * @param Attribute $attribute
209
     */
210
    protected function processDataType(string $definition, Attribute $attribute)
211
    {
212
        if (! preg_match(self::DATATYPE_PATTERN, $definition, $matches)) {
213
            throw new \LogicException(sprintf('Data-type definition "%s" is invalid.', $definition));
214
        }
215
216
        $attribute->setType($matches['type']);
217
218
        if (! empty($matches['many'])) {
219
            $attribute->setMany();
220
        }
221
222
        if (empty($matches['params'])) {
223
            return;
224
        }
225
226
        $parameters = explode(',', $matches['params']);
227
        $parameters = array_map('trim', $parameters);
228
229
        $attribute->setTypeParameters($parameters);
230
    }
231
}