@@ -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, |
@@ -254,7 +254,9 @@ |
||
254 | 254 | public function setOutputFile($file_name = null, $ext = null) |
255 | 255 | { |
256 | 256 | if (empty($file_name) || !is_string($file_name)) { |
257 | - if (!is_null($ext)) $ext = $this->default_ext; |
|
257 | + if (!is_null($ext)) { |
|
258 | + $ext = $this->default_ext; |
|
259 | + } |
|
258 | 260 | $file_name = $this->genTempFileName($ext); |
259 | 261 | } |
260 | 262 | return $this->full_file_name = $file_name; |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | } else { |
95 | 95 | //by default used this characters |
96 | 96 | $this->char_sets = [ |
97 | - 'abcdefghijklmnopqrstuvwxyz'. |
|
98 | - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. |
|
97 | + 'abcdefghijklmnopqrstuvwxyz' . |
|
98 | + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . |
|
99 | 99 | '01234567890_-.' |
100 | 100 | ]; |
101 | 101 | } |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | if ($len == \strlen($chars)) { |
116 | 116 | continue; |
117 | 117 | } |
118 | - $arr=[]; |
|
118 | + $arr = []; |
|
119 | 119 | for ($i = 0; $i < $len; $i++) { |
120 | 120 | $arr[] = \mb_substr($chars, $i, 1, "UTF-8"); |
121 | 121 | } |
122 | - $this->char_sets[$k]=$arr; |
|
122 | + $this->char_sets[$k] = $arr; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function md5RandomBytes($len) |
181 | 181 | { |
182 | - if ($len>0) { |
|
182 | + if ($len > 0) { |
|
183 | 183 | $start = mt_rand(9, PHP_INT_MAX); |
184 | 184 | $output = ''; |
185 | - for ($i=$start; strlen($output) < $len; $i++) { |
|
185 | + for ($i = $start; strlen($output) < $len; $i++) { |
|
186 | 186 | $output .= md5($i, true); |
187 | 187 | } |
188 | 188 | return substr($output, 0, $len); |