GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Right   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
dl 0
loc 58
rs 10
c 1
b 0
f 1
wmc 9

8 Methods

Rating   Name   Duplication   Size   Complexity  
A filter() 0 7 2
A map() 0 3 1
A leftMap() 0 4 1
A __construct() 0 3 1
A flatMap() 0 3 1
A match() 0 3 1
A otherwise() 0 3 1
A maybe() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Immutable\Either;
5
6
use Innmind\Immutable\{
7
    Either,
8
    Maybe,
9
};
10
11
/**
12
 * @template L1
13
 * @template R1
14
 * @implements Implementation<L1, R1>
15
 * @psalm-immutable
16
 * @internal
17
 */
18
final class Right implements Implementation
19
{
20
    /** @var R1 */
0 ignored issues
show
Bug introduced by
The type Innmind\Immutable\Either\R1 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...
21
    private $value;
22
23
    /**
24
     * @param R1 $value
25
     */
26
    public function __construct($value)
27
    {
28
        $this->value = $value;
29
    }
30
31
    public function map(callable $map): self
32
    {
33
        return new self($map($this->value));
34
    }
35
36
    public function flatMap(callable $map): Either
37
    {
38
        return $map($this->value);
39
    }
40
41
    /**
42
     * @template T
43
     *
44
     * @param callable(L1): T $map
45
     *
46
     * @return self<T, R1>
47
     */
48
    public function leftMap(callable $map): self
49
    {
50
        /** @var self<T, R1> */
51
        return $this;
52
    }
53
54
    public function match(callable $right, callable $left)
55
    {
56
        return $right($this->value);
57
    }
58
59
    public function otherwise(callable $otherwise): Either
60
    {
61
        return Either::right($this->value);
62
    }
63
64
    public function filter(callable $predicate, callable $otherwise): Implementation
65
    {
66
        if ($predicate($this->value) === true) {
67
            return $this;
68
        }
69
70
        return new Left($otherwise());
71
    }
72
73
    public function maybe(): Maybe
74
    {
75
        return Maybe::just($this->value);
76
    }
77
}
78