LogicOr::isTrue()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 3
rs 10
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
declare(strict_types=1);
13
14
namespace CaptainHook\App\Hook\Condition\Logic;
15
16
use CaptainHook\App\Console\IO;
17
use CaptainHook\App\Hook\Condition\Logic;
18
use SebastianFeldmann\Git\Repository;
19
20
/**
21
 * Connects multiple conditions with 'or'
22
 *
23
 * @package CaptainHook
24
 * @author  Sebastian Feldmann <[email protected]>
25
 * @author  Andreas Heigl <[email protected]>
26
 * @link    https://github.com/captainhook-git/captainhook
27
 * @since   Class available since Release 5.7.0
28
 */
29
final class LogicOr extends Logic
30
{
31 3
    public function isTrue(IO $io, Repository $repository): bool
32
    {
33 3
        foreach ($this->conditions as $condition) {
34 3
            if (true === $condition->isTrue($io, $repository)) {
35 2
                return true;
36
            }
37
        }
38 1
        return false;
39
    }
40
}
41