Constants::getConstants()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
/**
4
 * Spiral Framework. Cycle ProxyFactory
5
 *
6
 * @license MIT
7
 * @author  Valentin V (Vvval)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\ORM\Promise\Declaration\Extractor;
13
14
use ReflectionClass;
15
16
final class Constants
17
{
18
    /**
19
     * @param ReflectionClass $reflection
20
     * @return array
21
     */
22
    public function getConstants(ReflectionClass $reflection): array
23
    {
24
        $properties = [];
25
26
        foreach ($reflection->getReflectionConstants() as $constant) {
27
            if ($constant->isPrivate()) {
28
                continue;
29
            }
30
31
            $properties[] = $constant->name;
32
        }
33
34
        return $properties;
35
    }
36
}
37