Completed
Push — master ( 1cf10e...bfe5cd )
by Lorenzo
03:07
created

Enumerable   A

Complexity

Total Complexity 24

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 24
c 2
b 0
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 getCostants() 0 5 1
A isValidValue() 0 4 1
A getCostantsValues() 0 4 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 3
	public static function getCostants()
15
	{
16 3
		$oClass = new \ReflectionClass(__CLASS__);
17 3
		return $oClass->getConstants();
18
	}
19
20
    /**
21
     * @param $valore
22
     *
23
     * @return bool
24
     */
25 3
    public static function isValidValue($valore)
26
    {
27 3
        return in_array($valore, self::getCostants(), null);
28
    }
29
30
    /**
31
     * @param string $separator
32
     *
33
     * @return string
34
     */
35 3
    public static function getCostantsValues($separator=', ')
36
    {
37 3
        return implode($separator, self::getCostants());
38
    }
39
}
40