@@ -22,8 +22,7 @@ |
||
22 | 22 | |
23 | 23 | try { |
24 | 24 | return NetAddress::fromCidrString($str); |
25 | - } |
|
26 | - catch (\InvalidArgumentException $e) { |
|
25 | + } catch (\InvalidArgumentException $e) { |
|
27 | 26 | $this->throwInvalidValue($str, $e); |
28 | 27 | } |
29 | 28 | } |
@@ -27,8 +27,7 @@ |
||
27 | 27 | try { |
28 | 28 | $json = Json::fromEncoded($str); |
29 | 29 | return ($json->getValue() === null ? Json::null() : $json->getValue()); |
30 | - } |
|
31 | - catch (\InvalidArgumentException $e) { |
|
30 | + } catch (\InvalidArgumentException $e) { |
|
32 | 31 | $this->throwInvalidValue($str, $e); |
33 | 32 | } |
34 | 33 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | if ($str === null) { |
21 | 21 | return null; |
22 | - } |
|
23 | - else { |
|
22 | + } else { |
|
24 | 23 | preg_match_all('~\'((?:[^\']+|\'\')+)\'(?::([\d\w,]+))?~', $str, $matches, PREG_SET_ORDER); |
25 | 24 | $lexemes = []; |
26 | 25 | foreach ($matches as $m) { |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | $w = ((string)$p !== $pos ? substr($pos, strlen((string)$p)) : self::DEFAULT_WEIGHT); |
33 | 32 | $positions[] = [$p, $w]; |
34 | 33 | } |
35 | - } |
|
36 | - else { |
|
34 | + } else { |
|
37 | 35 | $positions = null; |
38 | 36 | } |
39 | 37 | $lexemes[$lex] = $positions; |
@@ -36,22 +36,17 @@ |
||
36 | 36 | if (!$val instanceof Time) { |
37 | 37 | if ($val instanceof \DateTimeInterface) { |
38 | 38 | $val = Time::fromDateTime($val); |
39 | - } |
|
40 | - elseif (is_numeric($val)) { |
|
39 | + } elseif (is_numeric($val)) { |
|
41 | 40 | $val = Time::fromUnixTimestamp($val); |
42 | - } |
|
43 | - elseif (is_string($val)) { |
|
41 | + } elseif (is_string($val)) { |
|
44 | 42 | try { |
45 | 43 | $val = Time::fromString($val); |
46 | - } |
|
47 | - catch (\InvalidArgumentException $e) { |
|
44 | + } catch (\InvalidArgumentException $e) { |
|
48 | 45 | $this->throwInvalidValue($val, $e); |
49 | - } |
|
50 | - catch (\OutOfRangeException $e) { |
|
46 | + } catch (\OutOfRangeException $e) { |
|
51 | 47 | $this->throwInvalidValue($val, $e); |
52 | 48 | } |
53 | - } |
|
54 | - else { |
|
49 | + } else { |
|
55 | 50 | $this->throwInvalidValue($val); |
56 | 51 | } |
57 | 52 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function defineTypeAlias(string $alias, string $schemaName, string $typeName) |
63 | 63 | { |
64 | - $this->nameTypeMap[$alias] =& $this->qualNameTypeMap[$schemaName][$typeName]; |
|
64 | + $this->nameTypeMap[$alias] = & $this->qualNameTypeMap[$schemaName][$typeName]; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | foreach ($this->typeSearchPath as $schemaName) { |
92 | 92 | foreach (($this->qualNameTypeMap[$schemaName] ?? []) as $typeName => $converter) { |
93 | 93 | if (!isset($this->searchedNameCache[$typeName])) { |
94 | - $this->searchedNameCache[$typeName] =& $this->qualNameTypeMap[$schemaName][$typeName]; |
|
94 | + $this->searchedNameCache[$typeName] = & $this->qualNameTypeMap[$schemaName][$typeName]; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | if ($searchPathPos !== false) { |
43 | 43 | if (!isset($this->searchedNameCache[$typeName])) { |
44 | 44 | $this->searchedNameCache[$typeName] = $type; |
45 | - } |
|
46 | - else { |
|
45 | + } else { |
|
47 | 46 | // find out whether the schema of $type is more preferred |
48 | 47 | $cachedPos = array_search($this->searchedNameCache[$typeName]->getSchemaName(), $this->typeSearchPath); |
49 | 48 | if ($cachedPos === false || $cachedPos > $searchPathPos) { |
@@ -138,13 +137,11 @@ discard block |
||
138 | 137 | if (isset($this->searchedNameCache[$typeName])) { |
139 | 138 | return $this->searchedNameCache[$typeName]; |
140 | 139 | } |
141 | - } |
|
142 | - elseif ($schemaName === false) { |
|
140 | + } elseif ($schemaName === false) { |
|
143 | 141 | if (isset($this->searchedNameCache[$typeName])) { |
144 | 142 | return $this->searchedNameCache[$typeName]; |
145 | 143 | } |
146 | - } |
|
147 | - else { |
|
144 | + } else { |
|
148 | 145 | if (isset($this->qualNameTypeMap[$schemaName][$typeName])) { |
149 | 146 | return $this->qualNameTypeMap[$schemaName][$typeName]; |
150 | 147 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | if ($this->baseType instanceof ITotallyOrderedType) { |
32 | 32 | return $this->baseType->compareValues($a, $b); |
33 | - } |
|
34 | - else { |
|
33 | + } else { |
|
35 | 34 | $msg = "The domain {$this->getSchemaName()}.{$this->getName()} base type is not totally ordered"; |
36 | 35 | throw new UnsupportedException($msg); |
37 | 36 | } |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | { |
42 | 41 | if ($this->baseType instanceof IDiscreteType) { |
43 | 42 | return $this->baseType->step($delta, $value); |
44 | - } |
|
45 | - else { |
|
43 | + } else { |
|
46 | 44 | $msg = "The domain {$this->getSchemaName()}.{$this->getName()} base type is not discrete"; |
47 | 45 | throw new UnsupportedException($msg); |
48 | 46 | } |
@@ -76,8 +76,7 @@ |
||
76 | 76 | if (count($key) == 1) { |
77 | 77 | unset($this->map[$k]); |
78 | 78 | return true; |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | $inner = $this->map[$k]; |
82 | 81 | if (!$this->isNestedMap($inner)) { |
83 | 82 | throw new \InvalidArgumentException("Invalid key `$k`"); |
@@ -10,19 +10,19 @@ |
||
10 | 10 | */ |
11 | 11 | interface ISet extends \Countable |
12 | 12 | { |
13 | - /** |
|
14 | - * @param mixed $value value to check presence of |
|
15 | - * @return bool <tt>true</tt> iff this set contains the <tt>$value</tt> |
|
16 | - */ |
|
17 | - function contains($value); |
|
13 | + /** |
|
14 | + * @param mixed $value value to check presence of |
|
15 | + * @return bool <tt>true</tt> iff this set contains the <tt>$value</tt> |
|
16 | + */ |
|
17 | + function contains($value); |
|
18 | 18 | |
19 | - /** |
|
20 | - * @param mixed $value value to add to the set |
|
21 | - */ |
|
22 | - function add($value); |
|
19 | + /** |
|
20 | + * @param mixed $value value to add to the set |
|
21 | + */ |
|
22 | + function add($value); |
|
23 | 23 | |
24 | - /** |
|
25 | - * @param mixed $value value to remove from the set |
|
26 | - */ |
|
27 | - function remove($value); |
|
24 | + /** |
|
25 | + * @param mixed $value value to remove from the set |
|
26 | + */ |
|
27 | + function remove($value); |
|
28 | 28 | } |
@@ -16,8 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | if (is_int($value) || is_string($value)) { |
18 | 18 | return $value; |
19 | - } |
|
20 | - else { |
|
19 | + } else { |
|
21 | 20 | return serialize($value); |
22 | 21 | } |
23 | 22 | } |