1 | <?php |
||
14 | final class GitBranches implements IteratorAggregate |
||
15 | { |
||
16 | /** |
||
17 | * @var GitWorkingCopy |
||
18 | */ |
||
19 | private $gitWorkingCopy; |
||
20 | |||
21 | public function __construct(GitWorkingCopy $gitWorkingCopy) |
||
26 | |||
27 | /** |
||
28 | * Fetches the branches via the `git branch` command. |
||
29 | * |
||
30 | * @api |
||
31 | * @param bool $onlyRemote Whether to fetch only remote branches, defaults to false which returns all branches. |
||
32 | * @return string[] |
||
33 | */ |
||
34 | public function fetchBranches(bool $onlyRemote = false): array |
||
41 | |||
42 | public function trimBranch(string $branch): string |
||
46 | |||
47 | public function getIterator(): ArrayIterator |
||
52 | |||
53 | /** |
||
54 | * @api |
||
55 | * @return string[] |
||
56 | */ |
||
57 | public function all(): array |
||
61 | |||
62 | /** |
||
63 | * @return string[] |
||
64 | */ |
||
65 | public function remote(): array |
||
69 | |||
70 | /** |
||
71 | * @api |
||
72 | * Returns currently active branch (HEAD) of the working copy. |
||
73 | */ |
||
74 | public function head(): string |
||
78 | } |
||
79 |