Code Duplication    Length = 15-16 lines in 3 locations

src/PhpGitHooks/Application/CodeSniffer/PhpCsConfigData.php 1 location

@@ 39-53 (lines=15) @@
36
        return self::TOOL;
37
    }
38
39
    private function setEnabled()
40
    {
41
        if (!isset($this->configData[self::TOOL])) {
42
            $answer = $this->setQuestion(
43
                sprintf('Do you want enable %s tool: ', strtoupper(self::TOOL)),
44
                self::DEFAULT_ANSWER,
45
                '[Y/n]'
46
            );
47
            $answer = self::DEFAULT_ANSWER === strtoupper($answer) ? true : false;
48
        } else {
49
            $answer = $this->configData[self::TOOL][self::ENABLED_KEY];
50
        }
51
52
        $this->enableTool($answer);
53
    }
54
55
    private function setStandard()
56
    {

src/PhpGitHooks/Application/PhpCsFixer/PhpCsFixerConfigData.php 1 location

@@ 77-92 (lines=16) @@
74
    /**
75
     * @throws InvalidPhpCsFixerConfigDataException
76
     */
77
    private function setEnabled()
78
    {
79
        if (!isset($this->configData[self::TOOL])) {
80
            $answer = $this->setQuestion(
81
                sprintf('Do you want enable %s tool: ', strtoupper(self::TOOL)),
82
                self::DEFAULT_ANSWER,
83
                '[Y/n]'
84
            );
85
            $answer = self::DEFAULT_ANSWER === strtoupper($answer) ? true : false;
86
        } else {
87
            $this->checkConfigData();
88
            $answer = $this->configData[self::TOOL][self::ENABLED_KEY];
89
        }
90
91
        $this->enableTool($answer);
92
    }
93
}
94

src/PhpGitHooks/Application/PhpUnit/PhpUnitConfigData.php 1 location

@@ 70-85 (lines=16) @@
67
        $this->configData[self::TOOL][self::RANDOM_MODE_KEY] = $answer;
68
    }
69
70
    private function setEnabled()
71
    {
72
        if (!isset($this->configData[self::TOOL])) {
73
            $answer = $this->setQuestion(
74
                sprintf('Do you want enable %s tool: ', strtoupper(self::TOOL)),
75
                self::DEFAULT_ANSWER,
76
                'Y/n'
77
            );
78
            $answer = self::DEFAULT_ANSWER === strtoupper($answer) ? true : false;
79
        } else {
80
            $this->checkConfigData();
81
            $answer = $this->configData[self::TOOL][self::ENABLED_KEY];
82
        }
83
84
        $this->enableTool($answer);
85
    }
86
}
87