@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | |
39 | 39 | public function __construct(?string $hex = null) |
40 | 40 | { |
41 | - if (! $hex) { |
|
41 | + if (!$hex) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $hex = $this->normalize($hex); |
46 | 46 | |
47 | - if (! $this->isValidHex($hex)) { |
|
47 | + if (!$this->isValidHex($hex)) { |
|
48 | 48 | throw new InvalidArgumentException(sprintf('Given hex value %s is invalid', $hex)); |
49 | 49 | } |
50 | 50 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function toHex() : string |
58 | 58 | { |
59 | - return ($this->color) ? '#' . $this->color : ''; |
|
59 | + return ($this->color) ? '#'.$this->color : ''; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $rgb = $this->toRGB(); |
84 | 84 | |
85 | - return 'rgb(' . implode(',', $rgb) . ')'; |
|
85 | + return 'rgb('.implode(',', $rgb).')'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function fromRGB(int $r, int $g, int $b) : Color |
134 | 134 | { |
135 | - $hex = dechex($r) . dechex($g) . dechex($b); |
|
135 | + $hex = dechex($r).dechex($g).dechex($b); |
|
136 | 136 | |
137 | 137 | return new self($hex); |
138 | 138 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | if (strlen($hex) === 3) { |
224 | 224 | // Convert to 6 digit version |
225 | - $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; |
|
225 | + $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | return strtoupper($hex); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | public static function fromCIDR(string $cidr) : IpRange |
65 | 65 | { |
66 | 66 | [$subnet, $bits] = explode('/', $cidr); |
67 | - $start = long2ip((ip2long($subnet)) & ((-1 << (32 - (int)$bits)))); |
|
68 | - $end = long2ip((ip2long($subnet)) + pow(2, (32 - (int)$bits))-1); |
|
67 | + $start = long2ip((ip2long($subnet)) & ((-1 << (32 - (int) $bits)))); |
|
68 | + $end = long2ip((ip2long($subnet)) + pow(2, (32 - (int) $bits)) - 1); |
|
69 | 69 | |
70 | 70 | return new IpRange(new IpAddress($start), new IpAddress($end)); |
71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function __toString() : string |
79 | 79 | { |
80 | - return $this->isEmpty() ? '' : $this->startIp . ' - ' . $this->endIp; |
|
80 | + return $this->isEmpty() ? '' : $this->startIp.' - '.$this->endIp; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | return [ |
93 | - 'startIp' => (string)$this->getStartIp(), |
|
94 | - 'endIp' => (string)$this->getEndIp(), |
|
93 | + 'startIp' => (string) $this->getStartIp(), |
|
94 | + 'endIp' => (string) $this->getEndIp(), |
|
95 | 95 | ]; |
96 | 96 | } |
97 | 97 |
@@ -27,8 +27,8 @@ |
||
27 | 27 | { |
28 | 28 | // This is only a soft validation to reduce headaches earlier. |
29 | 29 | // You SHOULD sanitize & validate actual email according to your needs, before using it as a value object! |
30 | - if ($email && ! filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
31 | - throw new InvalidArgumentException('Given e-mail address ' . $email . ' is not a valid'); |
|
30 | + if ($email && !filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
31 | + throw new InvalidArgumentException('Given e-mail address '.$email.' is not a valid'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $this->address = $email; |
@@ -36,13 +36,13 @@ |
||
36 | 36 | */ |
37 | 37 | public function __construct(string $addr = null) |
38 | 38 | { |
39 | - if (! $addr) { |
|
39 | + if (!$addr) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $filtered = filter_var($addr, FILTER_VALIDATE_IP); |
44 | 44 | if ($filtered === false) { |
45 | - throw new InvalidArgumentException('Given IP ' . $addr . ' is not a valid IP address'); |
|
45 | + throw new InvalidArgumentException('Given IP '.$addr.' is not a valid IP address'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->address = $filtered; |
@@ -84,7 +84,7 @@ |
||
84 | 84 | /** |
85 | 85 | * Returns duration of the date range in seconds. |
86 | 86 | */ |
87 | - public function getDurationInSeconds() : float|int |
|
87 | + public function getDurationInSeconds() : float | int |
|
88 | 88 | { |
89 | 89 | if (!$this->dateFrom) { |
90 | 90 | return 0; |