Code Duplication    Length = 14-14 lines in 2 locations

src/ReflectionEnum.php 1 location

@@ 186-199 (lines=14) @@
183
            $constants = [];
184
            $reflection = new \ReflectionClass($class);
185
186
            if (PHP_VERSION_ID >= 70100) {
187
                // Since PHP-7.1 visibility modifiers are allowed for class constants
188
                // for enumerations we are only interested in public once.
189
                foreach ($reflection->getReflectionConstants() as $refl_constant) {
190
                    if ($refl_constant->isPublic()) {
191
                        $constants[$refl_constant->getName()] = $refl_constant->getValue();
192
                    }
193
                }
194
            } else {
195
                // In PHP < 7.1 all class constants were public by definition
196
                foreach ($reflection->getConstants() as $constant => $constant_value) {
197
                    $constants[$constant] = $constant_value;
198
                }
199
            }
200
201
            foreach ($constants as $constant => $constant_value) {
202
                self::$constants[$class][$constant] = $constant_value;

src/Set.php 1 location

@@ 311-324 (lines=14) @@
308
            $constants = [];
309
            $reflection = new \ReflectionClass($class);
310
311
            if (PHP_VERSION_ID >= 70100) {
312
                // Since PHP-7.1 visibility modifiers are allowed for class constants
313
                // for enumerations we are only interested in public once.
314
                foreach ($reflection->getReflectionConstants() as $refl_constant) {
315
                    if ($refl_constant->isPublic()) {
316
                        $constants[$refl_constant->getName()] = $refl_constant->getValue();
317
                    }
318
                }
319
            } else {
320
                // In PHP < 7.1 all class constants were public by definition
321
                foreach ($reflection->getConstants() as $constant => $constant_value) {
322
                    $constants[$constant] = $constant_value;
323
                }
324
            }
325
326
            $bit = 1;
327
            foreach ($constants as $constant => $constant_value) {