@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | //check available function for quick-generation random bytes |
70 | 70 | foreach ([ |
71 | 71 | '\random_bytes', //for PHP7 |
72 | - '\openssl_random_pseudo_bytes',// better for PHP5, need OpenSSL ext |
|
72 | + '\openssl_random_pseudo_bytes', // better for PHP5, need OpenSSL ext |
|
73 | 73 | '\mcrypt_create_iv', // need MCRypt |
74 | 74 | ] as $fn) { |
75 | 75 | if (\function_exists($fn)) { |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | } else { |
96 | 96 | //by default used this characters |
97 | 97 | $this->char_sets = [ |
98 | - 'abcdefghijklmnopqrstuvwxyz'. |
|
99 | - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. |
|
98 | + 'abcdefghijklmnopqrstuvwxyz' . |
|
99 | + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . |
|
100 | 100 | '01234567890_-.' |
101 | 101 | ]; |
102 | 102 | } |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | if ($len == \strlen($chars)) { |
117 | 117 | continue; |
118 | 118 | } |
119 | - $arr=[]; |
|
119 | + $arr = []; |
|
120 | 120 | for ($i = 0; $i < $len; $i++) { |
121 | 121 | $arr[] = \mb_substr($chars, $i, 1, "UTF-8"); |
122 | 122 | } |
123 | - $this->char_sets[$k]=$arr; |
|
123 | + $this->char_sets[$k] = $arr; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function genRandomStr($len = 10, $char_set_num = 0) |
144 | 144 | { |
145 | - if (!isset($this->char_sets[$char_set_num]) || $len<1) { |
|
145 | + if (!isset($this->char_sets[$char_set_num]) || $len < 1) { |
|
146 | 146 | return false; |
147 | 147 | } elseif (is_array($this->char_sets[$char_set_num])) { |
148 | 148 | $l = count($this->char_sets[$char_set_num]); |
149 | 149 | } else { |
150 | 150 | $l = \strlen($this->char_sets[$char_set_num]); |
151 | 151 | } |
152 | - if (! $l) { |
|
152 | + if (!$l) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | $outstr = ''; |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function md5RandomBytes($len) |
182 | 182 | { |
183 | - if ($len>0) { |
|
183 | + if ($len > 0) { |
|
184 | 184 | $start = mt_rand(9, PHP_INT_MAX); |
185 | 185 | $output = ''; |
186 | - for ($i=$start; strlen($output) < $len; $i++) { |
|
186 | + for ($i = $start; strlen($output) < $len; $i++) { |
|
187 | 187 | $output .= md5($i, true); |
188 | 188 | } |
189 | 189 | return substr($output, 0, $len); |