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

All::isTrue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
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\FileStaged;
13
14
use CaptainHook\App\Console\IO;
15
use CaptainHook\App\Hook\Condition\FileStaged;
16
use SebastianFeldmann\Git\Repository;
17
18
/**
19
 * Class All
20
 *
21
 * The FileStaged condition is applicable for `pre-commit` hooks.
22
 * It checks if all configured files are staged for commit.
23
 *
24
 * @package CaptainHook
25
 * @author  Sebastian Feldmann <[email protected]>
26
 * @link    https://github.com/captainhookphp/captainhook
27
 * @since   Class available since Release 5.2.0
28
 */
29
class All extends FileStaged
30
{
31
    /**
32
     * Check if all of the configured files is staged for commit
33
     *
34
     * @param  \CaptainHook\App\Console\IO       $io
35
     * @param  \SebastianFeldmann\Git\Repository $repository
36
     * @return bool
37
     */
38
    public function isTrue(IO $io, Repository $repository): bool
39
    {
40
        return $this->allFilesInHaystack($this->filesToWatch, $this->getStagedFiles($repository));
41
    }
42
}
43