Passed
Push — master ( e9fe83...f34f5c )
by 4kizuki
06:12
created
src/Enum.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,44 +25,44 @@  discard block
 block discarded – undo
25 25
     private static $___constants = [ ];
26 26
     protected $scalar;
27 27
 
28
-    public function __construct( $scalar ) {
28
+    public function __construct($scalar) {
29 29
 
30 30
         self::_init( );
31 31
 
32
-        if( !self::_validate_constants( $scalar ) or !isset( self::$___constants[ static::class ][ 1 ][ $scalar ] ) )
32
+        if (!self::_validate_constants($scalar) or !isset(self::$___constants[ static::class ][ 1 ][ $scalar ]))
33 33
             throw new InvalidInitializerException;
34 34
 
35 35
         $this->scalar = $scalar;
36 36
 
37 37
     }
38 38
 
39
-    final public static function __callStatic( string $name, array $args ) {
39
+    final public static function __callStatic(string $name, array $args) {
40 40
 
41
-        if( !empty( $args ) ) throw new BadMethodCallException;
41
+        if (!empty($args)) throw new BadMethodCallException;
42 42
 
43 43
         self::_init( );
44 44
 
45
-        if( !isset( self::$___constants[ static::class ][ 0 ][ $name ] ) )
45
+        if (!isset(self::$___constants[ static::class ][ 0 ][ $name ]))
46 46
             throw new InvalidInitializerException;
47 47
 
48 48
         $class = static::class;
49
-        return new $class( self::$___constants[ static::class ][ 0 ][ $name ] );
49
+        return new $class(self::$___constants[ static::class ][ 0 ][ $name ]);
50 50
 
51 51
     }
52 52
 
53 53
     private static function _init( ) {
54 54
 
55
-        if( !isset( self::$___constants[ static::class ] ) ) {
55
+        if (!isset(self::$___constants[ static::class ])) {
56 56
 
57
-            $csts = ( new ReflectionClass( static::class ) )->getConstants( );
57
+            $csts = (new ReflectionClass(static::class))->getConstants( );
58 58
             $vals = [ ];
59 59
 
60
-            foreach( $csts as $key => $value ) {
60
+            foreach ($csts as $key => $value) {
61 61
 
62
-                if( !static::_validate_constants( $value ) )
63
-                    throw new EnumConstantTypeException( static::class, $key, gettype( $value ) );
62
+                if (!static::_validate_constants($value))
63
+                    throw new EnumConstantTypeException(static::class, $key, gettype($value));
64 64
 
65
-                $vals[$value] = true;
65
+                $vals[ $value ] = true;
66 66
 
67 67
             }
68 68
 
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function value( ) { return $this->scalar; }
76 76
 
77
-    protected static function _validate_constants( $value ) : bool {
77
+    protected static function _validate_constants($value) : bool {
78 78
 
79
-        if( is_int( $value ) ) return true;
80
-        if( is_string( $value ) && $value !== '' ) return true;
79
+        if (is_int($value)) return true;
80
+        if (is_string($value) && $value !== '') return true;
81 81
         return false;
82 82
 
83 83
     }
Please login to merge, or discard this patch.
src/Exceptions/InvalidInitializerException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 class InvalidInitializerException extends DomainException {
18 18
     
19 19
     public function __construct( ) {
20
-        parent::__construct( "Invalid enum initializer given. Given initializer isn't found in enum constants." );
20
+        parent::__construct("Invalid enum initializer given. Given initializer isn't found in enum constants.");
21 21
     }
22 22
     
23 23
 }
Please login to merge, or discard this patch.