Completed
Push — master ( 3592ed...983069 )
by Guillaume
02:39
created

StatusGuesser::isFailed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the hogosha-monitor package
5
 *
6
 * Copyright (c) 2016 Guillaume Cavana
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * Feel free to edit as you please, and have fun.
12
 *
13
 * @author Guillaume Cavana <[email protected]>
14
 */
15
16
namespace Hogosha\Monitor\Guesser;
17
18
use Hogosha\Monitor\Model\Result;
19
20
/**
21
 * Class StatusGuesser.
22
 */
23
class StatusGuesser
24
{
25
    const IDENTIFIED = 1;
26
    const RESOLVED = 0;
27
28
    /**
29
     * isOk.
30
     *
31
     * @param Result $result
32
     *
33
     * @return bool Return true is the condition is true
34
     */
35
    public function isOk(Result $result)
36
    {
37
        return $result->getUrl()->getExpectedStatus() == $result->getStatusCode();
38
    }
39
40
    /**
41
     * isFailed.
42
     *
43
     * @param Result $result
44
     *
45
     * @return bool Return true is the condition is false
46
     */
47
    public function isFailed(Result $result)
48
    {
49
        return !$this->isOk($result);
50
    }
51
}
52