Code Duplication    Length = 72-80 lines in 2 locations

src/Options/RequestOptions.php 1 location

@@ 9-88 (lines=80) @@
6
use DjThossi\SmokeTestingPhp\ValueObject\RequestTimeout;
7
use DjThossi\SmokeTestingPhp\ValueObject\Url;
8
9
class RequestOptions
10
{
11
    /**
12
     * @var Url
13
     */
14
    private $url;
15
16
    /**
17
     * @var RequestTimeout
18
     */
19
    private $requestTimeout;
20
21
    /**
22
     * @var FollowRedirect
23
     */
24
    private $followRedirect;
25
26
    /**
27
     * @var BasicAuth|null
28
     */
29
    private $basicAuth;
30
31
    /**
32
     * @param $url
33
     * @param RequestTimeout $requestTimeout
34
     * @param FollowRedirect $followRedirect
35
     * @param BasicAuth|null $basicAuth
36
     */
37
    public function __construct(
38
        Url $url,
39
        RequestTimeout $requestTimeout,
40
        FollowRedirect $followRedirect,
41
        BasicAuth $basicAuth = null
42
    ) {
43
        $this->url = $url;
44
        $this->requestTimeout = $requestTimeout;
45
        $this->followRedirect = $followRedirect;
46
        $this->basicAuth = $basicAuth;
47
    }
48
49
    /**
50
     * @return Url
51
     */
52
    public function getUrl()
53
    {
54
        return $this->url;
55
    }
56
57
    /**
58
     * @return RequestTimeout
59
     */
60
    public function getRequestTimeout()
61
    {
62
        return $this->requestTimeout;
63
    }
64
65
    /**
66
     * @return FollowRedirect
67
     */
68
    public function getFollowRedirect()
69
    {
70
        return $this->followRedirect;
71
    }
72
73
    /**
74
     * @return BasicAuth|null
75
     */
76
    public function getBasicAuth()
77
    {
78
        return $this->basicAuth;
79
    }
80
81
    /**
82
     * @return bool
83
     */
84
    public function needsBasicAuth()
85
    {
86
        return $this->basicAuth !== null;
87
    }
88
}
89

src/Options/RunnerOptions.php 1 location

@@ 9-80 (lines=72) @@
6
use DjThossi\SmokeTestingPhp\ValueObject\FollowRedirect;
7
use DjThossi\SmokeTestingPhp\ValueObject\RequestTimeout;
8
9
class RunnerOptions
10
{
11
    /**
12
     * @var UrlCollection
13
     */
14
    private $urls;
15
16
    /**
17
     * @var RequestTimeout
18
     */
19
    private $requestTimeout;
20
21
    /**
22
     * @var FollowRedirect
23
     */
24
    private $followRedirect;
25
26
    /**
27
     * @var BasicAuth|null
28
     */
29
    private $basicAuth;
30
31
    /**
32
     * @param UrlCollection $urls
33
     * @param RequestTimeout $requestTimeout
34
     * @param FollowRedirect $followRedirect
35
     * @param BasicAuth|null $basicAuth
36
     */
37
    public function __construct(
38
        UrlCollection $urls,
39
        RequestTimeout $requestTimeout,
40
        FollowRedirect $followRedirect,
41
        BasicAuth $basicAuth = null
42
    ) {
43
        $this->urls = $urls;
44
        $this->requestTimeout = $requestTimeout;
45
        $this->followRedirect = $followRedirect;
46
        $this->basicAuth = $basicAuth;
47
    }
48
49
    /**
50
     * @return UrlCollection
51
     */
52
    public function getUrls()
53
    {
54
        return $this->urls;
55
    }
56
57
    /**
58
     * @return RequestTimeout
59
     */
60
    public function getRequestTimeout()
61
    {
62
        return $this->requestTimeout;
63
    }
64
65
    /**
66
     * @return FollowRedirect
67
     */
68
    public function getFollowRedirect()
69
    {
70
        return $this->followRedirect;
71
    }
72
73
    /**
74
     * @return BasicAuth|null
75
     */
76
    public function getBasicAuth()
77
    {
78
        return $this->basicAuth;
79
    }
80
}
81