Completed
Push — master ( 70bb9e...3eb168 )
by George
04:48
created

Config::getReportEmailAddresses()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6667
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace SiteChecker;
4
5
6
/**
7
 * Class Config
8
 * @package SiteChecker
9
 */
10
class Config
11
{
12
    public $checkImages = true;
13
    public $checkCSS = true;
14
    public $checkJS = true;
15
    public $showFullTags = false;
16
    public $showOnlyProblems = false;
17
    public $checkExternal = false;
18
    public $reportEmail = null;
19
    public $reportEmailFrom = null;
20
    /**
21
     * It's not okay to have links with whitespaces, but browsers
22
     * usually fix it, so let's ignore it in most cases
23
     */
24
    public $ignoreWhiteSpaces = true;
25
    public $cookies = [];
26
    public $excludedUrls = [];
27
    public $includedUrls = [];
28
29
    /**
30
     * @return array
31
     */
32
    public function getCookies()
33
    {
34
        $cookies = [];
35
        foreach ($this->cookies as $cookie) {
36
            $cookies[] = (array)$cookie;
37
        }
38
        return (array)$cookies;
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    public function getReportEmailAddresses()
45
    {
46
        if (stristr($this->reportEmail, ',')) {
47
            return explode(',', $this->reportEmail);
48
49
        } else {
50
            return $this->reportEmail;
51
        }
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getMailFrom()
58
    {
59
        if (!empty($this->reportEmailFrom)) {
60
            return $this->reportEmailFrom;
61
        } else {
62
            $addresses = $this->getReportEmailAddresses();
63
            return $addresses[0];
64
        }
65
66
    }
67
}
68