1 | <?php |
||
32 | class MainCommand extends BaseCommand |
||
33 | { |
||
34 | const GIT_INIT = 'init'; |
||
35 | const GIT_STATUS = 'status'; |
||
36 | const GIT_ADD = 'add'; |
||
37 | const GIT_COMMIT = 'commit'; |
||
38 | const GIT_CHECKOUT = 'checkout'; |
||
39 | const GIT_MOVE = 'mv'; |
||
40 | const GIT_REMOVE = 'rm'; |
||
41 | const GIT_RESET = 'reset'; |
||
42 | |||
43 | /** |
||
44 | * constructor |
||
45 | * |
||
46 | * @param \GitElephant\Repository $repo The repository object this command |
||
47 | * will interact with |
||
48 | */ |
||
49 | 105 | public function __construct(Repository $repo = null) |
|
53 | |||
54 | /** |
||
55 | * Init the repository |
||
56 | * |
||
57 | * @param bool $bare |
||
58 | * |
||
59 | * @throws \RuntimeException |
||
60 | * @return MainCommand |
||
61 | */ |
||
62 | 99 | public function init($bare = false) |
|
72 | |||
73 | /** |
||
74 | * Get the repository status |
||
75 | * |
||
76 | * @param bool $porcelain |
||
77 | * |
||
78 | * @throws \RuntimeException |
||
79 | * @return string |
||
80 | */ |
||
81 | 12 | public function status($porcelain = false) |
|
93 | |||
94 | /** |
||
95 | * Add a node to the stage |
||
96 | * |
||
97 | * @param string $what what should be added to the repository |
||
98 | * |
||
99 | * @throws \RuntimeException |
||
100 | * @return string |
||
101 | */ |
||
102 | 94 | public function add($what = '.') |
|
111 | |||
112 | /** |
||
113 | * Remove a node from the stage and put in the working tree |
||
114 | * |
||
115 | * @param string $what what should be removed from the stage |
||
116 | * |
||
117 | * @throws \RuntimeException |
||
118 | * @return string |
||
119 | */ |
||
120 | 2 | public function unstage($what) |
|
129 | |||
130 | /** |
||
131 | * Commit |
||
132 | * |
||
133 | * @param string $message the commit message |
||
134 | * @param bool $stageAll commit all changes |
||
135 | * @param string|Author $author override the author for this commit |
||
136 | * |
||
137 | * @throws \RuntimeException |
||
138 | * @throws \InvalidArgumentException |
||
139 | * @return string |
||
140 | */ |
||
141 | 94 | public function commit($message, $stageAll = false, $author = null, $allowEmpty = false) |
|
167 | |||
168 | /** |
||
169 | * Checkout a treeish reference |
||
170 | * |
||
171 | * @param string|Branch $ref the reference to checkout |
||
172 | * |
||
173 | * @throws \RuntimeException |
||
174 | * @return string |
||
175 | */ |
||
176 | 23 | public function checkout($ref) |
|
193 | |||
194 | /** |
||
195 | * Move a file/directory |
||
196 | * |
||
197 | * @param string|Object $from source path |
||
198 | * @param string|Object $to destination path |
||
199 | * |
||
200 | * @throws \RuntimeException |
||
201 | * @throws \InvalidArgumentException |
||
202 | * @return string |
||
203 | */ |
||
204 | 1 | public function move($from, $to) |
|
224 | |||
225 | /** |
||
226 | * Remove a file/directory |
||
227 | * |
||
228 | * @param string|Object $path the path to remove |
||
229 | * @param bool $recursive recurse |
||
230 | * @param bool $force force |
||
231 | * |
||
232 | * @throws \RuntimeException |
||
233 | * @throws \InvalidArgumentException |
||
234 | * @return string |
||
235 | */ |
||
236 | 1 | public function remove($path, $recursive, $force) |
|
259 | |||
260 | /** |
||
261 | * Validates a path |
||
262 | * |
||
263 | * @param string $path path |
||
264 | * |
||
265 | * @return bool |
||
266 | */ |
||
267 | 2 | protected function validatePath($path) |
|
281 | } |
||
282 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.