Code Duplication    Length = 17-17 lines in 2 locations

lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php 1 location

@@ 1230-1246 (lines=17) @@
1227
     *
1228
     * @throws Mapping\MappingException If a cascade option is not valid.
1229
     */
1230
    private function getCascade(string $className, string $fieldName, array $originalCascades)
1231
    {
1232
        $cascadeTypes = ['remove', 'persist', 'refresh', 'merge', 'detach'];
1233
        $cascades     = array_map('strtolower', $originalCascades);
1234
1235
        if (in_array('all', $cascades)) {
1236
            $cascades = $cascadeTypes;
1237
        }
1238
1239
        if (count($cascades) !== count(array_intersect($cascades, $cascadeTypes))) {
1240
            $diffCascades = array_diff($cascades, array_intersect($cascades, $cascadeTypes));
1241
1242
            throw Mapping\MappingException::invalidCascadeOption($diffCascades, $className, $fieldName);
1243
        }
1244
1245
        return $cascades;
1246
    }
1247
1248
    /**
1249
     * Attempts to resolve the fetch mode.

lib/Doctrine/ORM/Mapping/Driver/NewAnnotationDriver.php 1 location

@@ 1128-1144 (lines=17) @@
1125
     *
1126
     * @throws Mapping\MappingException If a cascade option is not valid.
1127
     */
1128
    private function getCascade(string $className, string $fieldName, array $originalCascades)
1129
    {
1130
        $cascadeTypes = ['remove', 'persist', 'refresh', 'merge', 'detach'];
1131
        $cascades     = array_map('strtolower', $originalCascades);
1132
1133
        if (in_array('all', $cascades)) {
1134
            $cascades = $cascadeTypes;
1135
        }
1136
1137
        if (count($cascades) !== count(array_intersect($cascades, $cascadeTypes))) {
1138
            $diffCascades = array_diff($cascades, array_intersect($cascades, $cascadeTypes));
1139
1140
            throw Mapping\MappingException::invalidCascadeOption($diffCascades, $className, $fieldName);
1141
        }
1142
1143
        return $cascades;
1144
    }
1145
1146
    /**
1147
     * @param \ReflectionClass $reflectionClass