Passed
Push — main ( 604bfc...f70419 )
by Sebastian
04:51
created

PostRewrite   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10
ccs 6
cts 6
cp 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getChangedFiles() 0 8 1
1
<?php
2
3
/**
4
 * This file is part of CaptainHook.
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Git\ChangedFiles\Detector;
13
14
use CaptainHook\App\Git\ChangedFiles\Detector;
15
use CaptainHook\App\Git\Range\Detector\PostRewrite as RangeDetector;
16
17
/**
18
 * Class PostRewrite
19
 *
20
 * @package CaptainHook
21
 * @author  Sebastian Feldmann <[email protected]>
22
 * @link    https://github.com/captainhookphp/captainhook
23
 * @since   Class available since Release 5.20.0
24
 */
25
class PostRewrite extends Detector
26
{
27
    /**
28
     * Returns a list of changed files
29
     *
30
     * @param  array<string> $filter
31
     * @return array<string>
32
     */
33 1
    public function getChangedFiles(array $filter = []): array
34
    {
35 1
        $detector = new RangeDetector();
36 1
        $ranges   = $detector->getRanges($this->io);
37 1
        $old      = $ranges[0]->from()->id();
38 1
        $new      = $ranges[0]->to()->id();
39
40 1
        return $this->repository->getDiffOperator()->getChangedFiles($old, $new, $filter);
41
    }
42
}
43