Completed
Push — master ( f6cba5...5dbfda )
by Kacper
04:56
created

Enum   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A available() 0 8 2
A valid() 0 3 1
1
<?php
2
/**
3
 * Nucleus - XMPP Library for PHP
4
 *
5
 * Copyright (C) 2017, Some rights reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Xmpp\Utils;
17
18
19
class Enum
20
{
21
    public static function available() {
22
        static $reflection = null;
23
        if(!$reflection) {
24
            $reflection = new \ReflectionClass(static::class);
25
        }
26
27
        return $reflection->getConstants();
28
    }
29
30
    public static function valid($value) {
31
        return in_array($value, self::available());
32
    }
33
}