@@ -36,15 +36,15 @@ |
||
36 | 36 | */ |
37 | 37 | public $lim_elements = 10000; |
38 | 38 | |
39 | - /** |
|
40 | - * Model number for generation random Keys for Arrays |
|
41 | - * if 0 then array keys will be simple 1,2,3... numeric |
|
42 | - * if 1 then array keys will be numeric from min_arr_key to max_arr_key |
|
43 | - * if 2 then array keys will be string len from min_arr_key to max_arr_key |
|
44 | - * This value setting by function setKeysModel() |
|
45 | - * |
|
46 | - * @var integer |
|
47 | - */ |
|
39 | + /** |
|
40 | + * Model number for generation random Keys for Arrays |
|
41 | + * if 0 then array keys will be simple 1,2,3... numeric |
|
42 | + * if 1 then array keys will be numeric from min_arr_key to max_arr_key |
|
43 | + * if 2 then array keys will be string len from min_arr_key to max_arr_key |
|
44 | + * This value setting by function setKeysModel() |
|
45 | + * |
|
46 | + * @var integer |
|
47 | + */ |
|
48 | 48 | protected $keys_model; |
49 | 49 | |
50 | 50 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function countArrayValuesRecursive(&$arr, $cnt = 0) |
142 | 142 | { |
143 | - \array_walk_recursive($arr, function ($v, $k) use (&$cnt) { |
|
143 | + \array_walk_recursive($arr, function($v, $k) use (&$cnt) { |
|
144 | 144 | $cnt++; |
145 | 145 | }); |
146 | 146 | return $cnt; |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | $m_depth = $c_depth; |
163 | - \array_walk($arr, function ($v, $k) use ($c_depth, &$m_depth) { |
|
163 | + \array_walk($arr, function($v, $k) use ($c_depth, &$m_depth) { |
|
164 | 164 | if (is_array($v)) { |
165 | - $new_depth = $this->countArrayMaxDepth($v, $c_depth+1); |
|
165 | + $new_depth = $this->countArrayMaxDepth($v, $c_depth + 1); |
|
166 | 166 | if ($new_depth > $m_depth) { |
167 | 167 | $m_depth = $new_depth; |
168 | 168 | } |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | if (empty($chars)) { |
224 | 224 | //Numeric values model |
225 | 225 | $this->values_model = 1; |
226 | - if (!$min && $max==65535) { |
|
226 | + if (!$min && $max == 65535) { |
|
227 | 227 | //Non-changes values model (random number from 0 to 65535) |
228 | - $this->values_model=0; |
|
228 | + $this->values_model = 0; |
|
229 | 229 | } |
230 | 230 | } else { |
231 | 231 | //Random-string values model |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | if ($lim_elements) { |
297 | 297 | $this->lim_elements = $lim_elements; |
298 | 298 | } |
299 | - if ($lim_depth<1 |
|
299 | + if ($lim_depth < 1 |
|
300 | 300 | || $this->lim_elements < 0 |
301 | 301 | || $this->max_arr_key < 0 |
302 | 302 | || $this->max_arr_key < $this->min_arr_key |
@@ -311,11 +311,11 @@ discard block |
||
311 | 311 | $elem_cnt = $this->lim_elements; |
312 | 312 | } |
313 | 313 | $r_arr = []; |
314 | - $gen_arr = \unpack('v*', \call_user_func($this->rnd_fn, $elem_cnt*2)); |
|
315 | - $this->lim_elements-=$elem_cnt; |
|
314 | + $gen_arr = \unpack('v*', \call_user_func($this->rnd_fn, $elem_cnt * 2)); |
|
315 | + $this->lim_elements -= $elem_cnt; |
|
316 | 316 | |
317 | 317 | foreach ($gen_arr as $k => $v) { |
318 | - if ($v > $threshold || $lim_depth<2 || $this->lim_elements <2) { |
|
318 | + if ($v > $threshold || $lim_depth < 2 || $this->lim_elements < 2) { |
|
319 | 319 | if ($this->values_model) { |
320 | 320 | if ($this->values_model == 3) { |
321 | 321 | $v = \call_user_func($this->fn_gen_value, |
@@ -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 | |
@@ -180,14 +180,14 @@ 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 | 186 | while ($len > 16) { |
187 | 187 | $output .= md5($start++, true); |
188 | - $len-=16; |
|
188 | + $len -= 16; |
|
189 | 189 | } |
190 | - $output .= substr( md5($start, true), 0, $len); |
|
190 | + $output .= substr(md5($start, true), 0, $len); |
|
191 | 191 | return $output; |
192 | 192 | } |
193 | 193 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | } else { |
77 | 77 | $need_div = true; |
78 | 78 | } |
79 | - return $out_str; |
|
79 | + return $out_str; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function writeFileRandomJson($parr) |