Code Duplication    Length = 35-35 lines in 2 locations

src/Exercise/ConcernedAboutSeparation.php 1 location

@@ 78-112 (lines=35) @@
75
    /**
76
     * @return array
77
     */
78
    public function getArgs()
79
    {
80
        $folder = $this->getTemporaryPath();
81
82
        $files = [
83
            "learnyouphp.dat",
84
            "learnyouphp.txt",
85
            "learnyouphp.sql",
86
            "api.html",
87
            "README.md",
88
            "CHANGELOG.md",
89
            "LICENCE.md",
90
            "md",
91
            "data.json",
92
            "data.dat",
93
            "words.dat",
94
            "w00t.dat",
95
            "w00t.txt",
96
            "wrrrrongdat",
97
            "dat",
98
        ];
99
100
        $this->filesystem->mkdir($folder);
101
        array_walk($files, function ($file) use ($folder) {
102
            $this->filesystem->dumpFile(sprintf('%s/%s', $folder, $file), '');
103
        });
104
105
        $ext = '';
106
        while ($ext === '') {
107
            $index = array_rand($files);
108
            $ext = pathinfo($files[$index], PATHINFO_EXTENSION);
109
        }
110
111
        return [$folder, $ext];
112
    }
113
114
    /**
115
     * @return SolutionInterface

src/Exercise/FilteredLs.php 1 location

@@ 55-89 (lines=35) @@
52
    /**
53
     * @return array
54
     */
55
    public function getArgs()
56
    {
57
        $folder = $this->getTemporaryPath();
58
59
        $files = [
60
            "learnyouphp.dat",
61
            "learnyouphp.txt",
62
            "learnyouphp.sql",
63
            "api.html",
64
            "README.md",
65
            "CHANGELOG.md",
66
            "LICENCE.md",
67
            "md",
68
            "data.json",
69
            "data.dat",
70
            "words.dat",
71
            "w00t.dat",
72
            "w00t.txt",
73
            "wrrrrongdat",
74
            "dat",
75
        ];
76
77
        $this->filesystem->mkdir($folder);
78
        array_walk($files, function ($file) use ($folder) {
79
            $this->filesystem->dumpFile(sprintf('%s/%s', $folder, $file), '');
80
        });
81
82
        $ext = '';
83
        while ($ext === '') {
84
            $index = array_rand($files);
85
            $ext = pathinfo($files[$index], PATHINFO_EXTENSION);
86
        }
87
88
        return [$folder, $ext];
89
    }
90
91
    /**
92
     * @return null