Passed
Push — master ( a9840c...5ab0c2 )
by Todd
03:34
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 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
     $this->config = $config;
15 15
   }
16 16
 
17
-  public function find($path, $default=null, $delimiter='.') {
17
+  public function find($path, $default = null, $delimiter = '.') {
18 18
     if ($this->pathStartsWithConfig($path, $delimiter))
19 19
       return $this->evalSubPath($path, $delimiter, $default);
20 20
 
21 21
     return $this->get($this->getFirstToken($path, $delimiter), $default);
22 22
   }
23 23
 
24
-  private function get($name, $default=null) {
24
+  private function get($name, $default = null) {
25 25
     return $this->config->get($name, $default);
26 26
   }
27 27
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
   }
35 35
 
36 36
   private function getFirstToken($path, $delimiter) {
37
-    return $this->gettok($path, $delimiter,0);
37
+    return $this->gettok($path, $delimiter, 0);
38 38
   }
39 39
 
40 40
   private function evalSubPath($path, $delimiter, $default) {
Please login to merge, or discard this 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 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,23 +39,23 @@
 block discarded – undo
39 39
   }
40 40
 
41 41
   # ArrayAccess
42
-  public function offsetGet($offset)       { return $this->requireOffset($offset); }
43
-  public function offsetExists($offset)    { return isset($this->values[$offset]); }
44
-  public function offsetSet($offset, $val) { $this->values[$offset] = $val;        }
45
-  public function offsetUnset($offset)     { unset($this->values[$offset]);        }
42
+  public function offsetGet($offset) { return $this->requireOffset($offset); }
43
+  public function offsetExists($offset) { return isset($this->values[$offset]); }
44
+  public function offsetSet($offset, $val) { $this->values[$offset] = $val; }
45
+  public function offsetUnset($offset) { unset($this->values[$offset]); }
46 46
 
47 47
   # Iterator
48
-  public function rewind()  { return reset($this->values);        }
49
-  public function key()     { return key($this->values);          }
50
-  public function current() { return current($this->values);      }
51
-  public function next()    { return next($this->values);         }
52
-  public function valid()   { return key($this->values) !== null; }
48
+  public function rewind() { return reset($this->values); }
49
+  public function key() { return key($this->values); }
50
+  public function current() { return current($this->values); }
51
+  public function next() { return next($this->values); }
52
+  public function valid() { return key($this->values) !== null; }
53 53
 
54 54
   # Magic Property Access
55
-  public function __set($offset, $value) { $this->offsetSet($offset, $value);   }
56
-  public function __unset($offset)       { $this->offsetUnset($offset);         }
57
-  public function __get($offset)         { return $this->offsetGet($offset);    }
58
-  public function __isset($offset)       { return $this->offsetExists($offset); }
55
+  public function __set($offset, $value) { $this->offsetSet($offset, $value); }
56
+  public function __unset($offset) { $this->offsetUnset($offset); }
57
+  public function __get($offset) { return $this->offsetGet($offset); }
58
+  public function __isset($offset) { return $this->offsetExists($offset); }
59 59
 
60 60
   protected function requireOffset($offset) {
61 61
     if (!$this->offsetExists($offset))
Please login to merge, or discard this 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.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @see ../docs/config/README.md
11 11
  */
12 12
 abstract class Config extends Registry {
13
-  private $locked   = false;
13
+  private $locked = false;
14 14
 
15 15
   /**
16 16
    * Config constructor.
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
    */
20 20
   public function __construct(array $arrayConfig = []) {
21 21
     parent::__construct();
22
-    foreach($arrayConfig as $key => $value)
22
+    foreach ($arrayConfig as $key => $value)
23 23
       $this->offsetSet($key, $value);
24 24
 
25 25
     $this->onConstruct();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
   public function toArray() {
44 44
     return array_map(
45
-        function ($value) {
45
+        function($value) {
46 46
           // $value may be another Config object, if so then we toArray() it also.
47 47
           return $this->hasToArray($value) ? $value->toArray() : $value;
48 48
         },
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
    */
20 20
   public function __construct(array $arrayConfig = []) {
21 21
     parent::__construct();
22
-    foreach($arrayConfig as $key => $value)
23
-      $this->offsetSet($key, $value);
22
+    foreach($arrayConfig as $key => $value) {
23
+          $this->offsetSet($key, $value);
24
+    }
24 25
 
25 26
     $this->onConstruct();
26 27
   }
@@ -101,7 +102,8 @@  discard block
 block discarded – undo
101 102
    * @throws CanNotMutateException
102 103
    */
103 104
   private function blockIfLocked() {
104
-    if ($this->isLocked())
105
-      throw new CanNotMutateException();
105
+    if ($this->isLocked()) {
106
+          throw new CanNotMutateException();
107
+    }
106 108
   }
107 109
 }
108 110
\ No newline at end of file
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/Config/Field/Adapter/Particle.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
   }
25 25
 
26 26
   public static function required($name) : Particle {
27
-    $v = new Particle\Validator();;
27
+    $v = new Particle\Validator(); ;
28 28
     return new self($name, $v, $v->required($name));
29 29
   }
30 30
 
31 31
   public static function optional($name) : Particle {
32
-    $v = new Particle\Validator();;
32
+    $v = new Particle\Validator(); ;
33 33
     return new self($name, $v, $v->optional($name));
34 34
   }
35 35
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@
 block discarded – undo
41 41
     $particleResult = $this->validator->validate([
42 42
         $this->name => $value
43 43
     ]);
44
-    if ($particleResult->isValid())
45
-      return new Field\Validation\ValidResult();
44
+    if ($particleResult->isValid()) {
45
+          return new Field\Validation\ValidResult();
46
+    }
46 47
 
47 48
     return $this->invalidResult($particleResult);
48 49
   }
Please login to merge, or discard this patch.
src/Config/Field/Validation/Validator/Regex.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($pattern, $description = null) {
17
-    if (!$this->isValidRegexPattern($pattern))
18
-      throw new Exception("Invalid Regex pattern: {$pattern}");
17
+    if (!$this->isValidRegexPattern($pattern)) {
18
+          throw new Exception("Invalid Regex pattern: {$pattern}");
19
+    }
19 20
     $this->pattern = $pattern;
20 21
     $this->message = $description;
21 22
   }
Please login to merge, or discard this patch.
src/Config/Field/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.
src/Config/Field/Field.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
   protected $validators = [];
17 17
 
18 18
   public function __construct($name) {
19
-    if (!$this->isValidName($name))
20
-      throw new InvalidFieldNameException();
19
+    if (!$this->isValidName($name)) {
20
+          throw new InvalidFieldNameException();
21
+    }
21 22
     $this->name = $name;
22 23
   }
23 24
 
@@ -48,11 +49,13 @@  discard block
 block discarded – undo
48 49
   }
49 50
 
50 51
   public function validate($value): ValidationResult {
51
-    if ($this->isRequired() || $this->isNotEmpty($value))
52
-      $this->runValidators($value);
52
+    if ($this->isRequired() || $this->isNotEmpty($value)) {
53
+          $this->runValidators($value);
54
+    }
53 55
 
54
-    if ($this->isRequiredAndEmpty($value) && count($this->messages) === 0)
55
-      $this->addMessage('Required');
56
+    if ($this->isRequiredAndEmpty($value) && count($this->messages) === 0) {
57
+          $this->addMessage('Required');
58
+    }
56 59
 
57 60
     return $this->validationResult();
58 61
   }
@@ -87,8 +90,9 @@  discard block
 block discarded – undo
87 90
 
88 91
   protected function runValidators($value) {
89 92
     foreach ($this->validators as $validator) {
90
-      if (!$validator->validate($value))
91
-        $this->addMessage($validator->getDescription());
93
+      if (!$validator->validate($value)) {
94
+              $this->addMessage($validator->getDescription());
95
+      }
92 96
     }
93 97
   }
94 98
 
Please login to merge, or discard this patch.