Total Complexity | 9 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | class ChangelogReleaseResolver |
||
9 | { |
||
10 | /** |
||
11 | * @var \Vaimo\ComposerChangelogs\Validators\ConstraintValidator |
||
12 | */ |
||
13 | private $constraintValidator; |
||
14 | |||
15 | /** |
||
16 | * @var \Vaimo\ComposerChangelogs\Analysers\ReleaseAnalyser |
||
17 | */ |
||
18 | private $releaseAnalyser; |
||
19 | |||
20 | public function __construct() |
||
24 | } |
||
25 | |||
26 | public function resolveLatestVersionedRelease(array $changelog, $branch = '') |
||
27 | { |
||
28 | foreach ($changelog as $version => $item) { |
||
29 | if (!$this->constraintValidator->isConstraint($version)) { |
||
30 | continue; |
||
31 | } |
||
32 | |||
33 | if (!$this->releaseAnalyser->isSameBranch($item, $branch)) { |
||
34 | continue; |
||
35 | } |
||
36 | |||
37 | return $version; |
||
38 | } |
||
39 | |||
40 | return false; |
||
41 | } |
||
42 | |||
43 | public function resolveUpcomingRelease(array $changelog, $branch = '') |
||
58 | } |
||
59 | } |
||
60 |