Passed
Branch master (2adf12)
by Filippo
02:58
created
src/Meta/MetaClass.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,11 +66,13 @@  discard block
 block discarded – undo
66 66
    * @param[in] bool $allowNull When `true` allows a `null` value.
67 67
    */
68 68
   public function setMetadata($name, $value, $override = TRUE, $allowNull = TRUE) {
69
-    if (is_null($value) && !$allowNull)
70
-      return;
69
+    if (is_null($value) && !$allowNull) {
70
+          return;
71
+    }
71 72
 
72
-    if ($this->isMetadataPresent($name) && !$override)
73
-      return;
73
+    if ($this->isMetadataPresent($name) && !$override) {
74
+          return;
75
+    }
74 76
 
75 77
     $this->meta[$name] = $value;
76 78
   }
@@ -81,8 +83,9 @@  discard block
 block discarded – undo
81 83
    * @param[in] string $name The metadata name.
82 84
    */
83 85
   public function unsetMetadata($name) {
84
-    if (array_key_exists($name, $this->meta))
85
-      unset($this->meta[$name]);
86
+    if (array_key_exists($name, $this->meta)) {
87
+          unset($this->meta[$name]);
88
+    }
86 89
   }
87 90
 
88 91
 
@@ -104,9 +107,9 @@  discard block
 block discarded – undo
104 107
   public function assignArray(array $array) {
105 108
     if (ArrayHelper::isAssociative($array)) {
106 109
       $this->meta = array_merge($this->meta, $array);
110
+    } else {
111
+          throw new \InvalidArgumentException("\$array must be an associative array.");
107 112
     }
108
-    else
109
-      throw new \InvalidArgumentException("\$array must be an associative array.");
110 113
   }
111 114
 
112 115
 
@@ -131,8 +134,9 @@  discard block
 block discarded – undo
131 134
       JSON_PRESERVE_ZERO_FRACTION
132 135
     );
133 136
 
134
-    if ($json === FALSE)
135
-      throw new JSONErrorException(json_last_error_msg());
137
+    if ($json === FALSE) {
138
+          throw new JSONErrorException(json_last_error_msg());
139
+    }
136 140
 
137 141
     return $json;
138 142
   }
Please login to merge, or discard this patch.
src/Meta/Extension/TProperty.php 1 patch
Braces   +20 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,31 +18,35 @@
 block discarded – undo
18 18
 trait TProperty {
19 19
 
20 20
   public function __get($name) {
21
-    if (method_exists($this, ($method = 'get'.ucfirst($name))))
22
-      return $this->$method();
23
-    else
24
-      throw new \BadMethodCallException("Method $method is not implemented for property $name.");
21
+    if (method_exists($this, ($method = 'get'.ucfirst($name)))) {
22
+          return $this->$method();
23
+    } else {
24
+          throw new \BadMethodCallException("Method $method is not implemented for property $name.");
25
+    }
25 26
   }
26 27
 
27 28
   public function __isset($name) {
28
-    if (method_exists($this, ($method = 'isset'.ucfirst($name))))
29
-      return $this->$method();
30
-    else
31
-      throw new \BadMethodCallException("Method $method is not implemented for property $name.");
29
+    if (method_exists($this, ($method = 'isset'.ucfirst($name)))) {
30
+          return $this->$method();
31
+    } else {
32
+          throw new \BadMethodCallException("Method $method is not implemented for property $name.");
33
+    }
32 34
   }
33 35
 
34 36
   public function __set($name, $value) {
35
-    if (method_exists($this, ($method = 'set'.ucfirst($name))))
36
-      $this->$method($value);
37
-    else
38
-      throw new \BadMethodCallException("Method $method is not implemented for property $name.");
37
+    if (method_exists($this, ($method = 'set'.ucfirst($name)))) {
38
+          $this->$method($value);
39
+    } else {
40
+          throw new \BadMethodCallException("Method $method is not implemented for property $name.");
41
+    }
39 42
   }
40 43
 
41 44
   public function __unset($name) {
42
-    if (method_exists($this, ($method = 'unset'.ucfirst($name))))
43
-      $this->$method();
44
-    else
45
-      throw new \BadMethodCallException("Method $method is not implemented for property $name.");
45
+    if (method_exists($this, ($method = 'unset'.ucfirst($name)))) {
46
+          $this->$method();
47
+    } else {
48
+          throw new \BadMethodCallException("Method $method is not implemented for property $name.");
49
+    }
46 50
   }
47 51
 
48 52
 }
49 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Meta/MetaCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@
 block discarded – undo
111 111
    * @param[in] integer $offset The offset to retrieve.
112 112
    * @retval mixed Can return all value types.
113 113
    */
114
-  public function offsetGet($offset)  {
114
+  public function offsetGet($offset) {
115 115
     return $this->meta[$this->name][$offset];
116 116
   }
117 117
 
Please login to merge, or discard this patch.