1 | <?php |
||
24 | class Hook extends ConfigHandler |
||
25 | { |
||
26 | /** |
||
27 | * Path to the git repository |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $repositoryPath; |
||
32 | |||
33 | /** |
||
34 | * Hook that gets executed. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $hookToExecute; |
||
39 | |||
40 | /** |
||
41 | * Hook to command map |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $hookCommandMap = [ |
||
46 | 'pre-commit' => 'PreCommit', |
||
47 | 'commit-msg' => 'CommitMsg', |
||
48 | 'pre-push' => 'PrePush' |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * Repository path setter. |
||
53 | * |
||
54 | * @param string $git |
||
55 | */ |
||
56 | 1 | public function setRepositoryPath($git) |
|
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | 2 | public function getRepositoryPath() |
|
71 | |||
72 | /** |
||
73 | * Set the hook to execute. |
||
74 | * |
||
75 | * @param string $hook |
||
76 | * @return \sebastianfeldmann\CaptainHook\Console\Application\Hook |
||
77 | */ |
||
78 | 2 | public function setHook($hook) |
|
86 | |||
87 | /** |
||
88 | * Execute hook. |
||
89 | * |
||
90 | * @param \Symfony\Component\Console\Input\InputInterface $input |
||
91 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
92 | * @return int |
||
93 | */ |
||
94 | 2 | public function doRun(InputInterface $input, OutputInterface $output) |
|
101 | |||
102 | /** |
||
103 | * Create the hook command. |
||
104 | * |
||
105 | * @return \sebastianfeldmann\CaptainHook\Console\Command\Hook |
||
106 | */ |
||
107 | 2 | private function createCommand() |
|
116 | |||
117 | /** |
||
118 | * Get the command class name to execute. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | 2 | private function getHookCommand() |
|
129 | } |
||
130 |