Completed
Push — master ( a7bf70...50513b )
by Pol
25s queued 12s
created

Boolean::gt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\churchencoding;
6
7
use Closure;
8
use loophp\combinator\Combinators;
0 ignored issues
show
Bug introduced by
The type loophp\combinator\Combinators was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * Class Boolean.
12
 *
13
 * phpcs:disable Generic.Files.LineLength.TooLong
14
 */
15
final class Boolean
16
{
17 5
    public static function CAnd(): Closure
18
    {
19 5
        return static fn (callable $l): Closure => static fn (callable $c): Closure => $l($c)(self::CFalse());
20
    }
21
22 23
    public static function CFalse(): Closure
23
    {
24 23
        return Combinators::Ki();
25
    }
26
27 5
    public static function CIf(): Closure
28
    {
29 5
        return Combinators::I();
30
    }
31
32 5
    public static function CNot(): Closure
33
    {
34 5
        return Combinators::C();
35
    }
36
37 3
    public static function COr(): Closure
38
    {
39 3
        return Combinators::M();
40
    }
41
42 22
    public static function CTrue(): Closure
43
    {
44 22
        return Combinators::K();
45
    }
46
47 3
    public static function CXor(): Closure
48
    {
49 3
        return static fn (callable $a): Closure => static fn (callable $b): Closure => ($a($b(self::CFalse())(self::CTrue())))($b(self::CTrue())(self::CFalse()));
50
    }
51
52 1
    public static function eq(): Closure
53
    {
54 1
        return static fn (callable $a): Closure => static fn (callable $b): Closure => self::CAnd()(self::lte()($a)($b))(self::lte()($b)($a));
55
    }
56
57 1
    public static function gt(): Closure
58
    {
59 1
        return static fn (callable $a): Closure => static fn (callable $b): Closure => self::CNot()(self::lte()($a)($b));
60
    }
61
62 2
    public static function gte(): Closure
63
    {
64 2
        return static fn (callable $a): Closure => static fn (callable $b): Closure => self::isZero()(Numeral::minus()($b)($a));
65
    }
66
67 6
    public static function isZero(): Closure
68
    {
69 6
        return static fn (callable $a): Closure => $a(Combinators::K()(self::CFalse()))(self::CTrue());
70
    }
71
72 1
    public static function lt(): Closure
73
    {
74 1
        return static fn (callable $a): Closure => static fn (callable $b): Closure => self::CNot()(self::gte()($a)($b));
75
    }
76
77 3
    public static function lte(): Closure
78
    {
79 3
        return static fn (callable $a): Closure => static fn (callable $b): Closure => self::isZero()(Numeral::minus()($a)($b));
80
    }
81
}
82