@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @extends \SplFixedArray |
19 | 19 | */ |
20 | -class ByteArray extends SplFixedArray{ |
|
20 | +class ByteArray extends SplFixedArray { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @return string |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return string |
31 | 31 | */ |
32 | 32 | public function toHex():string{ |
33 | - return $this->map(function($v){ |
|
33 | + return $this->map(function($v) { |
|
34 | 34 | return str_pad(dechex($v), '2', '0', STR_PAD_LEFT); |
35 | 35 | }); |
36 | 36 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return string |
54 | 54 | */ |
55 | 55 | public function toBin():string{ |
56 | - return $this->map(function($v){ |
|
56 | + return $this->map(function($v) { |
|
57 | 57 | return str_pad(decbin($v), '8', '0', STR_PAD_LEFT); |
58 | 58 | }); |
59 | 59 | } |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | $diff = $offset + $length; |
84 | 84 | |
85 | - if($diff > $this->count()){ |
|
85 | + if ($diff > $this->count()) { |
|
86 | 86 | $this->setSize($diff); |
87 | 87 | } |
88 | 88 | |
89 | - for($i = 0; $i < $length; $i++){ |
|
89 | + for ($i = 0; $i < $length; $i++) { |
|
90 | 90 | $this[$i + $offset] = $src[$i + $srcOffset]; |
91 | 91 | } |
92 | 92 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | |
104 | 104 | // keep an extended class |
105 | 105 | /** @var \chillerlan\Traits\ArrayHelpers\ByteArray $slice */ |
106 | - $slice = (new ReflectionClass($this))->newInstanceArgs([$length ?? ($this->count() - $offset)]); |
|
106 | + $slice = (new ReflectionClass($this))->newInstanceArgs([$length ?? ($this->count() - $offset)]); |
|
107 | 107 | |
108 | - foreach($slice as $i => $_){ |
|
108 | + foreach ($slice as $i => $_) { |
|
109 | 109 | $slice[$i] = $this[$offset + $i]; |
110 | 110 | } |
111 | 111 | |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function equal(SplFixedArray $array):bool{ |
121 | 121 | |
122 | - if($this->count() !== $array->count()){ |
|
122 | + if ($this->count() !== $array->count()) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $diff = 0; |
127 | 127 | |
128 | - foreach($this as $k => $v){ |
|
128 | + foreach ($this as $k => $v) { |
|
129 | 129 | $diff |= $v ^ $array[$k]; |
130 | 130 | } |
131 | 131 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @link http://php.net/manual/class.arrayaccess.php |
19 | 19 | */ |
20 | -trait ArrayAccessTrait{ |
|
20 | +trait ArrayAccessTrait { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var array |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @link http://php.net/manual/arrayaccess.offsetget.php |
42 | 42 | * @inheritdoc |
43 | 43 | */ |
44 | - public function offsetGet($offset){ |
|
44 | + public function offsetGet($offset) { |
|
45 | 45 | return $this->array[$offset] ?? null; |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @link http://php.net/manual/arrayaccess.offsetset.php |
50 | 50 | * @inheritdoc |
51 | 51 | */ |
52 | - public function offsetSet($offset, $value){ |
|
52 | + public function offsetSet($offset, $value) { |
|
53 | 53 | |
54 | 54 | $offset !== null |
55 | 55 | ? $this->array[$offset] = $value |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @link http://php.net/manual/arrayaccess.offsetunset.php |
61 | 61 | * @inheritdoc |
62 | 62 | */ |
63 | - public function offsetUnset($offset){ |
|
63 | + public function offsetUnset($offset) { |
|
64 | 64 | unset($this->array[$offset]); |
65 | 65 | } |
66 | 66 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * a generic container with magic getter and setter |
15 | 15 | */ |
16 | -interface ContainerInterface{ |
|
16 | +interface ContainerInterface { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param iterable $properties |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\Traits; |
14 | 14 | |
15 | -interface EnumerableInterface{ |
|
15 | +interface EnumerableInterface { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @return array |
@@ -12,6 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\Traits; |
14 | 14 | |
15 | -abstract class ContainerAbstract implements ContainerInterface{ |
|
15 | +abstract class ContainerAbstract implements ContainerInterface { |
|
16 | 16 | use Container; |
17 | 17 | } |
@@ -46,9 +46,9 @@ |
||
46 | 46 | * |
47 | 47 | * @throws \chillerlan\Traits\Crypto\CryptoException |
48 | 48 | */ |
49 | - public function __construct(array $properties = null){ |
|
49 | + public function __construct(array $properties = null) { |
|
50 | 50 | |
51 | - if(!extension_loaded('sodium') || !function_exists('sodium_memzero')){ |
|
51 | + if (!extension_loaded('sodium') || !function_exists('sodium_memzero')) { |
|
52 | 52 | throw new CryptoException('sodium extension (PHP 7.2+) required!'); // @codeCoverageIgnore |
53 | 53 | } |
54 | 54 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * |
21 | 21 | * @method \chillerlan\Traits\Crypto\CryptoBoxInterface open(string $box_bin, string $nonce_bin) |
22 | 22 | */ |
23 | -interface CryptoBoxInterface{ |
|
23 | +interface CryptoBoxInterface { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param string $message |
@@ -14,4 +14,4 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\Traits\TraitException; |
16 | 16 | |
17 | -class CryptoException extends TraitException{} |
|
17 | +class CryptoException extends TraitException {} |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @property string $secret |
18 | 18 | * @property string $public |
19 | 19 | */ |
20 | -interface CryptoKeyInterface{ |
|
20 | +interface CryptoKeyInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @param string|null $seed_bin |