1 | <?php declare(strict_types=1); |
||
12 | final class GitBranches implements IteratorAggregate, Countable |
||
13 | { |
||
14 | /** |
||
15 | * @var GitWorkingCopy |
||
16 | */ |
||
17 | private $gitWorkingCopy; |
||
18 | |||
19 | public function __construct(GitWorkingCopy $gitWorkingCopy) |
||
24 | |||
25 | /** |
||
26 | * Fetches the branches via the `git branch` command. |
||
27 | * |
||
28 | * @param bool $onlyRemote Whether to fetch only remote branches, defaults to false which returns all branches. |
||
29 | * |
||
30 | * @return mixed[] |
||
31 | */ |
||
32 | public function fetchBranches(bool $onlyRemote = false): array |
||
39 | |||
40 | public function trimBranch(string $branch): string |
||
44 | |||
45 | public function getIterator(): ArrayIterator |
||
50 | |||
51 | /** |
||
52 | * @return string[] |
||
53 | */ |
||
54 | public function all(): array |
||
58 | |||
59 | /** |
||
60 | * @return string[] |
||
61 | */ |
||
62 | public function remote(): array |
||
66 | |||
67 | /** |
||
68 | * Returns currently active branch (HEAD) of the working copy. |
||
69 | */ |
||
70 | public function head(): string |
||
74 | |||
75 | /** |
||
76 | * Count elements of an object |
||
77 | * @link https://php.net/manual/en/countable.count.php |
||
78 | * @return int The custom count as an integer. |
||
79 | * </p> |
||
80 | * <p> |
||
81 | * The return value is cast to an integer. |
||
82 | * @since 5.1.0 |
||
83 | */ |
||
84 | public function count(): int |
||
88 | } |
||
89 |