Code Duplication    Length = 58-62 lines in 4 locations

src/Exercise/ArrayWeFilter.php 1 location

@@ 18-78 (lines=61) @@
15
 * Class ArrayWeFilter
16
 * @package PhpSchool\CallableFunctions\Exercise
17
 */
18
class ArrayWeFilter extends AbstractExercise implements
19
    ExerciseInterface,
20
    CliExercise,
21
    FunctionRequirementsExerciseCheck
22
{
23
    /**
24
     * @return string
25
     */
26
    public function getName()
27
    {
28
        return 'Array we filter!';
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getDescription()
35
    {
36
        return 'Exercice with array filter';
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function getArgs()
43
    {
44
        return [1, 2, 3, 4, 5];
45
    }
46
47
    /**
48
     * @return ExerciseType
49
     */
50
    public function getType()
51
    {
52
        return ExerciseType::CLI();
53
    }
54
55
    /**
56
     * @return string[]
57
     */
58
    public function getRequiredFunctions()
59
    {
60
        return ['array_filter'];
61
    }
62
63
    /**
64
     * @return string[]
65
     */
66
    public function getBannedFunctions()
67
    {
68
        return [];
69
    }
70
71
    /**
72
     * @param ExerciseDispatcher $dispatcher
73
     */
74
    public function configure(ExerciseDispatcher $dispatcher)
75
    {
76
        $dispatcher->requireCheck(FunctionRequirementsCheck::class, $dispatcher::CHECK_AFTER);
77
    }
78
}
79

src/Exercise/ArrayWeMap.php 1 location

@@ 18-75 (lines=58) @@
15
 * Class ArrayWeMap
16
 * @package PhpSchool\CallableFunctions\Exercise
17
 */
18
class ArrayWeMap extends AbstractExercise implements ExerciseInterface, CliExercise, FunctionRequirementsExerciseCheck
19
{
20
    /**
21
     * @return string
22
     */
23
    public function getName()
24
    {
25
        return 'Array we map!';
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getDescription()
32
    {
33
        return 'Exercice with array map';
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getArgs()
40
    {
41
        return ['Sarra', 'Helen', 'Anas'];
42
    }
43
44
    /**
45
     * @return ExerciseType
46
     */
47
    public function getType()
48
    {
49
        return ExerciseType::CLI();
50
    }
51
52
    /**
53
     * @return string[]
54
     */
55
    public function getRequiredFunctions()
56
    {
57
        return ['array_map'];
58
    }
59
60
    /**
61
     * @return string[]
62
     */
63
    public function getBannedFunctions()
64
    {
65
        return [];
66
    }
67
68
    /**
69
     * @param ExerciseDispatcher $dispatcher
70
     */
71
    public function configure(ExerciseDispatcher $dispatcher)
72
    {
73
        $dispatcher->requireCheck(FunctionRequirementsCheck::class, $dispatcher::CHECK_AFTER);
74
    }
75
}
76

src/Exercise/ArrayWeReduce.php 1 location

@@ 18-79 (lines=62) @@
15
 * Class ArrayWeReduce
16
 * @package PhpSchool\CallableFunctions\Exercise
17
 */
18
class ArrayWeReduce extends AbstractExercise implements
19
    ExerciseInterface,
20
    CliExercise,
21
    FunctionRequirementsExerciseCheck
22
{
23
    /**
24
     * @return string
25
     */
26
    public function getName()
27
    {
28
        return 'Array we reduce!';
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getDescription()
35
    {
36
        return 'Exercice with array reduce';
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function getArgs()
43
    {
44
        return [1, 2, 3];
45
    }
46
47
    /**
48
     * @return ExerciseType
49
     */
50
    public function getType()
51
    {
52
        return ExerciseType::CLI();
53
    }
54
55
56
    /**
57
     * @return string[]
58
     */
59
    public function getRequiredFunctions()
60
    {
61
        return ['array_reduce'];
62
    }
63
64
    /**
65
     * @return string[]
66
     */
67
    public function getBannedFunctions()
68
    {
69
        return [];
70
    }
71
72
    /**
73
     * @param ExerciseDispatcher $dispatcher
74
     */
75
    public function configure(ExerciseDispatcher $dispatcher)
76
    {
77
        $dispatcher->requireCheck(FunctionRequirementsCheck::class, $dispatcher::CHECK_AFTER);
78
    }
79
}
80

src/Exercise/PeaceWalk.php 1 location

@@ 18-75 (lines=58) @@
15
 * Class PeaceWalk
16
 * @package PhpSchool\CallableFunctions\Exercise
17
 */
18
class PeaceWalk extends AbstractExercise implements ExerciseInterface, CliExercise, FunctionRequirementsExerciseCheck
19
{
20
    /**
21
     * @return string
22
     */
23
    public function getName()
24
    {
25
        return 'Peace walk';
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getDescription()
32
    {
33
        return 'Exercice with array_walk';
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getArgs()
40
    {
41
        return ['Sarra', 'Helen', 'Anas'];
42
    }
43
44
    /**
45
     * @return ExerciseType
46
     */
47
    public function getType()
48
    {
49
        return ExerciseType::CLI();
50
    }
51
52
    /**
53
     * @return string[]
54
     */
55
    public function getRequiredFunctions()
56
    {
57
        return ['array_walk'];
58
    }
59
60
    /**
61
     * @return string[]
62
     */
63
    public function getBannedFunctions()
64
    {
65
        return [];
66
    }
67
68
    /**
69
     * @param ExerciseDispatcher $dispatcher
70
     */
71
    public function configure(ExerciseDispatcher $dispatcher)
72
    {
73
        $dispatcher->requireCheck(FunctionRequirementsCheck::class, $dispatcher::CHECK_AFTER);
74
    }
75
}
76