Code Duplication    Length = 24-26 lines in 2 locations

src/RandomArray.php 1 location

@@ 318-343 (lines=26) @@
315
        $this->lim_elements-=$elem_cnt;
316
        
317
        foreach ($gen_arr as $k => $v) {
318
            if ($v > $threshold || $lim_depth<2 || $this->lim_elements <2) {
319
                if ($this->values_model) {
320
                    if ($this->values_model == 3) {
321
                        $v = \call_user_func($this->fn_gen_value,
322
                            \compact('k', 'v', 'threshold', 'lim_depth', 'root')
323
                        );
324
                    } else {
325
                        $v = mt_rand($this->min_arr_val, $this->max_arr_val);
326
                        if ($this->values_model == 2) {
327
                            $v = $this->genRandomStr($v, 2);
328
                        }
329
                    }
330
                } else {
331
                    if (!$this->keys_model) {
332
                        continue;
333
                    }
334
                }
335
            } else {
336
                $v = $this->genRandomArray(
337
                    $min_elem_cnt,
338
                    $max_elem_cnt,
339
                    $threshold,
340
                    $lim_depth - 1,
341
                    0
342
                );
343
            }
344
            if ($this->keys_model) {
345
                if ($this->keys_model === 3) {
346
                    $k = \call_user_func($this->fn_gen_key,

src/RandomToFile.php 1 location

@@ 189-212 (lines=24) @@
186
                }
187
            }
188
            
189
            if ($v > $threshold || $lim_depth < 2 || $this->lim_elements < 2) {
190
                if ($this->values_model) {
191
                    if ($this->values_model == 3) {
192
                        $v = \call_user_func($this->fn_gen_value,
193
                            \compact('k', 'v', 'threshold', 'lim_depth', 'root')
194
                        );
195
                    } else {
196
                        $v = mt_rand($this->min_arr_val, $this->max_arr_val);
197
                        if ($this->values_model == 2) {
198
                            $v = $this->genRandomStr($v, 2);
199
                        }
200
                    }
201
                }
202
            } else {
203
                $this->genRandomToFile(
204
                    $min_elem_cnt,
205
                    $max_elem_cnt,
206
                    $threshold,
207
                    $lim_depth - 1,
208
                    0,
209
                    $k
210
                );
211
                continue;
212
            }
213
214
            \call_user_func($this->fn_file_output,
215
                \compact('signal', 'k', 'v', 'fh', 'lim_depth', 'root')