Conditions | 2 |
Paths | 1 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
45 | 4 | public function __invoke(PathInterface $project): void |
|
46 | { |
||
47 | 4 | $git = new Path($project.'/.git'); |
|
48 | 4 | $repository = $this->git->repository($project); |
|
49 | 4 | $previousBranch = $repository->head(); |
|
50 | |||
51 | ($this->watch)($git)(function() use (&$previousBranch, $repository) { |
||
52 | 4 | $currentBranch = $repository->head(); |
|
53 | |||
54 | 4 | if ((string) $currentBranch === (string) $previousBranch) { |
|
55 | 2 | return; |
|
56 | } |
||
57 | |||
58 | 4 | $previousBranch = $currentBranch; |
|
59 | 4 | $monitor = $this->ipc->get($this->monitor); |
|
60 | 4 | $monitor->send( |
|
61 | 4 | $this->protocol->encode( |
|
62 | 4 | new Activity( |
|
63 | 4 | Type::gitBranchChanged(), |
|
64 | 4 | ['branch' => (string) $currentBranch] |
|
65 | ) |
||
66 | ) |
||
67 | ); |
||
68 | 4 | $monitor->close(); |
|
69 | 4 | }); |
|
72 |