Completed
Branch master (1f9106)
by Nils
02:44
created

Result::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 6
nc 1
nop 5
1
<?php
2
3
namespace whm\Smoke\Scanner;
4
5
use whm\Smoke\Http\Response;
6
7
class Result
8
{
9
    private $type;
10
    private $messages = array();
11
    private $response;
12
    private $parent;
13
    private $url;
14
    private $duration;
15
16
    public function __construct($uri, $type, Response $response, $parent, $duration)
17
    {
18
        $this->type = $type;
19
        $this->url = $uri;
20
        $this->response = $response;
21
        $this->parent = $parent;
22
        $this->duration = $duration;
23
    }
24
25
    public function isFailure()
26
    {
27
        return $this->type === Scanner::ERROR;
28
    }
29
30
    public function isSuccess()
31
    {
32
        return $this->type === Scanner::PASSED;
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function getMessages()
39
    {
40
        return $this->messages;
41
    }
42
43
    public function setMessages(array $messages)
44
    {
45
        $this->messages = $messages;
46
    }
47
48
    /**
49
     * @return mixed
50
     */
51
    public function getResponse()
52
    {
53
        return $this->response;
54
    }
55
56
    /**
57
     * @return mixed
58
     */
59
    public function getParent()
60
    {
61
        return $this->parent;
62
    }
63
64
    /**
65
     * @return mixed
66
     */
67
    public function getUrl()
68
    {
69
        return $this->url;
70
    }
71
72
    public function getDuration()
73
    {
74
        return $this->duration;
75
    }
76
}
77