Enumerable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 3
c 3
b 1
f 1
lcom 0
cbo 0
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isValidValue() 0 4 1
A getCostantsValues() 0 4 1
A getCostants() 0 5 1
1
<?php
2
3
namespace Padosoft\TesseraSanitaria\traits;
4
5
/**
6
 * Class Enumerable
7
 * @package Padosoft\TesseraSanitaria\traits
8
 */
9
trait Enumerable
10
{
11
    /**
12
     * @return array
13
     */
14 15
    public static function getCostants()
15
    {
16 15
        $oClass = new \ReflectionClass(__CLASS__);
17 15
        return $oClass->getConstants();
18
    }
19
20
    /**
21
     * @param $valore
22
     *
23
     * @return bool
24
     */
25 15
    public static function isValidValue($valore)
26
    {
27 15
        return in_array($valore, self::getCostants(), null);
28
    }
29
30
    /**
31
     * @param string $separator
32
     *
33
     * @return string
34
     */
35 15
    public static function getCostantsValues($separator = ', ')
36
    {
37 15
        return implode($separator, self::getCostants());
38
    }
39
}
40