@@ -37,7 +37,9 @@ |
||
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 |
@@ -15,8 +15,9 @@ |
||
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 | } |
@@ -58,8 +58,9 @@ |
||
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 | } |
@@ -19,8 +19,9 @@ discard block |
||
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 |
||
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 |
@@ -17,22 +17,25 @@ |
||
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 | } |
@@ -41,8 +41,9 @@ |
||
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 | } |
@@ -14,8 +14,9 @@ |
||
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 | } |
@@ -14,8 +14,9 @@ |
||
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}"; |
@@ -23,8 +23,9 @@ discard block |
||
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 |
||
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 |
||
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 |