Passed
Push — master ( 8c447f...2d37d5 )
by Todd
02:21
created
src/Config/MutableConfig.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
 
38 38
   private function nextNumericIndex() {
39 39
     $numericKeys = array_filter(array_keys($this->rawValues()), 'is_numeric');
40
-    if (count($numericKeys) === 0) return 0;
40
+    if (count($numericKeys) === 0) {
41
+      return 0;
42
+    }
41 43
     return max($numericKeys) + 1;
42 44
   }
43 45
 }
44 46
\ No newline at end of file
Please login to merge, or discard this patch.
src/Config/PathEval.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
   }
16 16
 
17 17
   public function find($path, $default=null, $delimiter='.') {
18
-    if ($this->pathStartsWithConfig($path, $delimiter))
19
-      return $this->evalSubPath($path, $delimiter, $default);
18
+    if ($this->pathStartsWithConfig($path, $delimiter)) {
19
+          return $this->evalSubPath($path, $delimiter, $default);
20
+    }
20 21
 
21 22
     return $this->get($this->getFirstToken($path, $delimiter), $default);
22 23
   }
Please login to merge, or discard this patch.
src/Registry.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@
 block discarded – undo
58 58
   public function __isset($offset)       { return $this->offsetExists($offset); }
59 59
 
60 60
   protected function requireOffset($offset) {
61
-    if (!$this->offsetExists($offset))
62
-      throw new \OutOfBoundsException("offset '{$offset}' does not exist");
61
+    if (!$this->offsetExists($offset)) {
62
+          throw new \OutOfBoundsException("offset '{$offset}' does not exist");
63
+    }
63 64
 
64 65
     return $this->values[$offset];
65 66
   }
Please login to merge, or discard this patch.
src/Config/StrictConfig.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,22 +17,25 @@
 block discarded – undo
17 17
 
18 18
   public function isValid() {
19 19
     foreach ($this->_fields as $field) {
20
-      if (!$this->isFieldValid($field))
21
-        return false;
20
+      if (!$this->isFieldValid($field)) {
21
+              return false;
22
+      }
22 23
     }
23 24
     return true;
24 25
   }
25 26
 
26 27
   public function validate() {
27
-    if (!$this->isValid())
28
-      throw new InvalidConfigStateException($this);
28
+    if (!$this->isValid()) {
29
+          throw new InvalidConfigStateException($this);
30
+    }
29 31
   }
30 32
 
31 33
   public function validationMessages() {
32 34
     $failures = [];
33 35
     foreach ($this->_fields as $field) {
34
-      if (!$this->isFieldValid($field))
35
-        $failures[$field->getName()] = $this->fieldValidationMessages($field);
36
+      if (!$this->isFieldValid($field)) {
37
+              $failures[$field->getName()] = $this->fieldValidationMessages($field);
38
+      }
36 39
     }
37 40
     return $failures;
38 41
   }
Please login to merge, or discard this patch.
src/Pair.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
     $this->validateNotNull($key);
24 24
     $this->validateNotObjectOrHasToString($key);
25 25
 
26
-    if (is_numeric($key) || is_string($key))
27
-      return $key;
26
+    if (is_numeric($key) || is_string($key)) {
27
+          return $key;
28
+    }
28 29
 
29 30
     return (string) $key;
30 31
   }
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
    * @throws InvalidTypeException
35 36
    */
36 37
   private function validateNotNull($key) {
37
-    if (is_null($key))
38
-      throw new InvalidTypeException('Can not use null for a key');
38
+    if (is_null($key)) {
39
+          throw new InvalidTypeException('Can not use null for a key');
40
+    }
39 41
   }
40 42
 
41 43
   /**
@@ -43,7 +45,8 @@  discard block
 block discarded – undo
43 45
    * @throws InvalidTypeException
44 46
    */
45 47
   private function validateNotObjectOrHasToString($key) {
46
-    if (is_object($key) && !method_exists($key, '__toString'))
47
-      throw new InvalidTypeException('Object keys must implement __toString');
48
+    if (is_object($key) && !method_exists($key, '__toString')) {
49
+          throw new InvalidTypeException('Object keys must implement __toString');
50
+    }
48 51
   }
49 52
 }
50 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Config/Field/Field.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
   protected $validators = [];
15 15
 
16 16
   public function __construct($name) {
17
-    if (!$this->isValidName($name))
18
-      throw new InvalidFieldNameException();
17
+    if (!$this->isValidName($name)) {
18
+          throw new InvalidFieldNameException();
19
+    }
19 20
     $this->name = $name;
20 21
   }
21 22
 
@@ -46,11 +47,13 @@  discard block
 block discarded – undo
46 47
   }
47 48
 
48 49
   public function validate($value): Validation\Result {
49
-    if ($this->isRequiredOrNotEmpty($value))
50
-      $this->runValidators($value);
50
+    if ($this->isRequiredOrNotEmpty($value)) {
51
+          $this->runValidators($value);
52
+    }
51 53
 
52
-    if ($this->isRequiredAndEmpty($value) && count($this->messages) === 0)
53
-      $this->addMessage('Required');
54
+    if ($this->isRequiredAndEmpty($value) && count($this->messages) === 0) {
55
+          $this->addMessage('Required');
56
+    }
54 57
 
55 58
     return $this->validationResult();
56 59
   }
@@ -89,8 +92,9 @@  discard block
 block discarded – undo
89 92
 
90 93
   protected function runValidators($value) {
91 94
     foreach ($this->validators as $validator) {
92
-      if (!$validator->validate($value))
93
-        $this->addMessage($validator->getDescription());
95
+      if (!$validator->validate($value)) {
96
+              $this->addMessage($validator->getDescription());
97
+      }
94 98
     }
95 99
   }
96 100
 
Please login to merge, or discard this patch.
src/Config/Field/Adapter/Particle.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@
 block discarded – undo
42 42
     $particleResult = $this->validator->validate([
43 43
         $this->name => $value
44 44
     ]);
45
-    if ($particleResult->isValid())
46
-      return new Validation\ValidResult();
45
+    if ($particleResult->isValid()) {
46
+          return new Validation\ValidResult();
47
+    }
47 48
 
48 49
     return $this->invalidResult($particleResult);
49 50
   }
Please login to merge, or discard this patch.
src/Config.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
   }
27 27
 
28 28
   public function import(array $data) {
29
-    foreach ($data as $key=>$value) $this->offsetSet($key, $value);
29
+    foreach ($data as $key=>$value) {
30
+      $this->offsetSet($key, $value);
31
+    }
30 32
   }
31 33
 
32 34
   // override this to have a base config
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
   }
83 85
 
84 86
   protected function settableValue($value) {
85
-    if (is_array($value)) return $this->subConfig($value);
87
+    if (is_array($value)) {
88
+      return $this->subConfig($value);
89
+    }
86 90
     return $value;
87 91
   }
88 92
 
@@ -116,7 +120,8 @@  discard block
 block discarded – undo
116 120
    * @throws CanNotMutateException
117 121
    */
118 122
   private function blockIfLocked() {
119
-    if ($this->isLocked())
120
-      throw new CanNotMutateException();
123
+    if ($this->isLocked()) {
124
+          throw new CanNotMutateException();
125
+    }
121 126
   }
122 127
 }
123 128
\ No newline at end of file
Please login to merge, or discard this patch.
src/Validation/Validator/IsInstanceOf.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
    * @throws Exception
15 15
    */
16 16
   public function __construct($fqcn, $description = null) {
17
-    if (!$this->isValidClassName($fqcn))
18
-      throw new Exception("Invalid Regex pattern: {$fqcn}");
17
+    if (!$this->isValidClassName($fqcn)) {
18
+          throw new Exception("Invalid Regex pattern: {$fqcn}");
19
+    }
19 20
 
20 21
     $this->fqcn = $fqcn;
21 22
     $this->description = $description ?? "Must be an instance of {$fqcn}";
Please login to merge, or discard this patch.