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

Detector::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
ccs 3
cts 3
cp 1
crap 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;
13
14
use CaptainHook\App\Console\IO;
15
use SebastianFeldmann\Git\Repository;
16
17
/**
18
 * Class Detector
19
 *
20
 * Base class for all ChangedFiles Detecting implementations.
21
 *
22
 * @package CaptainHook
23
 * @author  Sebastian Feldmann <[email protected]>
24
 * @link    https://github.com/captainhookphp/captainhook
25
 * @since   Class available since Release 5.20.0
26
 */
27
abstract class Detector implements Detecting
28
{
29
    /**
30
     * Input output handling
31
     *
32
     * @var \CaptainHook\App\Console\IO
33
     */
34
    protected IO $io;
35
36
    /**
37
     * Git repository
38
     *
39
     * @var \SebastianFeldmann\Git\Repository
40
     */
41
    protected Repository $repository;
42
43
    /**
44
     * Constructor
45
     *
46
     * @param \CaptainHook\App\Console\IO       $io
47
     * @param \SebastianFeldmann\Git\Repository $repository
48
     */
49 23
    public function __construct(IO $io, Repository $repository)
50
    {
51 23
        $this->io         = $io;
52 23
        $this->repository = $repository;
53
    }
54
55
    /**
56
     * Returns a list of changed files
57
     *
58
     * @param  array<string> $filter
59
     * @return array<string>
60
     */
61
    abstract public function getChangedFiles(array $filter = []): array;
62
}
63