@@ 72-84 (lines=13) @@ | ||
69 | * @param \SebastianFeldmann\CaptainHook\Config\Hook $config |
|
70 | * @throws \Exception |
|
71 | */ |
|
72 | private function setupPHPLintingHook(Config\Hook $config) |
|
73 | { |
|
74 | $answer = $this->io->ask( |
|
75 | ' <info>Do you want to check your files for syntax errors?</info> <comment>[y,n]</comment> ', |
|
76 | 'n' |
|
77 | ); |
|
78 | ||
79 | if (IOUtil::answerToBool($answer)) { |
|
80 | $type = 'php'; |
|
81 | $call = '\\SebastianFeldmann\\CaptainHook\\Hook\\PHP\\Action\\Linting'; |
|
82 | $config->addAction(new Config\Action($type, $call)); |
|
83 | } |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * Setup the phpunit hook |
|
@@ 92-106 (lines=15) @@ | ||
89 | * @param \SebastianFeldmann\CaptainHook\Config\Hook $config |
|
90 | * @throws \Exception |
|
91 | */ |
|
92 | private function setupPHPUnitHook(Config\Hook $config) |
|
93 | { |
|
94 | $answer = $this->io->ask( |
|
95 | ' <info>Do you want to run phpunit before committing?</info> <comment>[y,n]</comment> ', |
|
96 | 'n' |
|
97 | ); |
|
98 | ||
99 | if (IOUtil::answerToBool($answer)) { |
|
100 | $type = 'cli'; |
|
101 | $call = $this->io->ask( |
|
102 | ' <info>Enter the phpunit command you want to execute.</info> ' |
|
103 | . '<comment>[phpunit]</comment> ', 'phpunit'); |
|
104 | $config->addAction(new Config\Action($type, $call)); |
|
105 | } |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * Setup the code sniffer hook |
|
@@ 114-130 (lines=17) @@ | ||
111 | * @param \SebastianFeldmann\CaptainHook\Config\Hook $config |
|
112 | * @throws \Exception |
|
113 | */ |
|
114 | private function setupPHPCodesnifferHook(Config\Hook $config) |
|
115 | { |
|
116 | $answer = $this->io->ask( |
|
117 | ' <info>Do you want to run phpcs before committing?</info> <comment>[y,n]</comment> ', |
|
118 | 'n' |
|
119 | ); |
|
120 | ||
121 | if (IOUtil::answerToBool($answer)) { |
|
122 | $type = 'cli'; |
|
123 | $call = $this->io->ask( |
|
124 | ' <info>Enter the phpcs command you want to execute.</info> ' |
|
125 | . '<comment>[phpcs --standard=psr2 src]</comment> ', |
|
126 | 'phpcs --standard=psr2 src' |
|
127 | ); |
|
128 | $config->addAction(new Config\Action($type, $call)); |
|
129 | } |
|
130 | } |
|
131 | } |
|
132 |