Completed
Push — master ( 9f6466...621974 )
by Freek
02:29 queued 58s
created

HealthCheckFailure::wasUnexpected()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Backup\Tasks\Monitor;
4
5
use Exception;
6
use Spatie\Backup\Exceptions\InvalidHealthCheck;
7
8
class HealthCheckFailure
9
{
10
    /** @var \Spatie\Backup\Tasks\Monitor */
11
    protected $healthCheck;
12
13
    /** @var \Exception */
14
    protected $exception;
15
16
    public function __construct(HealthCheck $healthCheck, Exception $exception)
17
    {
18
        $this->healthCheck = $healthCheck;
0 ignored issues
show
Documentation Bug introduced by
It seems like $healthCheck of type object<Spatie\Backup\Tasks\Monitor\HealthCheck> is incompatible with the declared type object<Spatie\Backup\Tasks\Monitor> of property $healthCheck.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
19
20
        $this->exception = $exception;
21
    }
22
23
    public function healthCheck(): HealthCheck
24
    {
25
        return $this->healthCheck;
26
    }
27
28
    public function exception(): Exception
29
    {
30
        return $this->exception;
31
    }
32
33
    public function wasUnexpected(): bool
34
    {
35
        return ! $this->exception instanceof InvalidHealthCheck;
36
    }
37
}
38