Passed
Push — master ( 8b4244...ea75f3 )
by stéphane
03:50
created
yaml/Compact.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,12 @@
 block discarded – undo
25 25
     public function jsonSerialize():array
26 26
     {
27 27
         $prop = get_object_vars($this);
28
-        if (count($prop) > 0) return $prop;
29
-        if (count($this) > 0) return iterator_to_array($this);
28
+        if (count($prop) > 0) {
29
+            return $prop;
30
+        }
31
+        if (count($this) > 0) {
32
+            return iterator_to_array($this);
33
+        }
30 34
     }
31 35
 
32 36
     /**
Please login to merge, or discard this patch.
yaml/Node2PHP.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,12 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function get(Node $n)
25 25
     {
26
-        if (is_null($n->value)) return null;
27
-        if ($n->type & (Y::REF_CALL | Y::SCALAR)) return self::getScalar($n->value);
26
+        if (is_null($n->value)) {
27
+            return null;
28
+        }
29
+        if ($n->type & (Y::REF_CALL | Y::SCALAR)) {
30
+            return self::getScalar($n->value);
31
+        }
28 32
         if ($n->type & Y::JSON) {
29 33
             return $n->value;
30 34
         }
@@ -43,8 +47,12 @@  discard block
 block discarded – undo
43 47
      */
44 48
     private static function getScalar(string $v)
45 49
     {
46
-        if (R::isDate($v))   return date_create($v);
47
-        if (R::isNumber($v)) return self::getNumber($v);
50
+        if (R::isDate($v)) {
51
+            return date_create($v);
52
+        }
53
+        if (R::isNumber($v)) {
54
+            return self::getNumber($v);
55
+        }
48 56
         $types = ['yes'   => true,
49 57
                     'no'    => false,
50 58
                     'true'  => true,
@@ -66,8 +74,12 @@  discard block
 block discarded – undo
66 74
      */
67 75
     private static function getNumber(string $v)
68 76
     {
69
-        if (preg_match("/^(0o\d+)$/i", $v))      return intval(base_convert($v, 8, 10));
70
-        if (preg_match("/^(0x[\da-f]+)$/i", $v)) return intval(base_convert($v, 16, 10));
77
+        if (preg_match("/^(0o\d+)$/i", $v)) {
78
+            return intval(base_convert($v, 8, 10));
79
+        }
80
+        if (preg_match("/^(0x[\da-f]+)$/i", $v)) {
81
+            return intval(base_convert($v, 16, 10));
82
+        }
71 83
         return is_bool(strpos($v, '.')) ? intval($v) : floatval($v);
72 84
     }
73 85
 }
74 86
\ No newline at end of file
Please login to merge, or discard this patch.