Passed
Push — master ( e83f83...b17f39 )
by Sebastian
02:59
created

All::didAllFilesChange()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 10
ccs 4
cts 4
cp 1
cc 3
nc 3
nop 1
crap 3
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\Hook\Condition\FileChanged;
13
14
use CaptainHook\App\Console\IO;
15
use CaptainHook\App\Hook\Condition\FileChanged;
16
use SebastianFeldmann\Git\Repository;
17
18
/**
19
 * Class All
20
 *
21
 * The FileChange condition is applicable for `post-merge` and `post-checkout` hooks.
22
 * It checks if all configured files are updated within the last change set.
23
 *
24
 * @package CaptainHook
25
 * @author  Sebastian Feldmann <[email protected]>
26
 * @link    https://github.com/captainhookphp/captainhook
27
 * @since   Class available since Release 4.2.0
28
 */
29
class All extends FileChanged
30
{
31
    /**
32
     * Check if all of the configured files where changed within the applied change set
33
     *
34
     * IMPORTANT: If no files are configured this condition is always true.
35
     *
36 2
     * @param  \CaptainHook\App\Console\IO       $io
37
     * @param  \SebastianFeldmann\Git\Repository $repository
38 2
     * @return bool
39
     */
40
    public function isTrue(IO $io, Repository $repository): bool
41
    {
42
        return $this->allFilesInHaystack($this->filesToWatch, $this->getChangedFiles($io, $repository));
43
    }
44
}
45