Config   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 10
Bugs 1 Features 3
Metric Value
wmc 6
c 10
b 1
f 3
lcom 2
cbo 0
dl 0
loc 57
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCookies() 0 8 2
A getReportEmailAddresses() 0 8 2
A getMailFrom() 0 10 2
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
50
        return [$this->reportEmail];
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getMailFrom()
57
    {
58
        if (!empty($this->reportEmailFrom)) {
59
            return $this->reportEmailFrom;
60
        }
61
62
        $addresses = $this->getReportEmailAddresses();
63
        return $addresses[0];
64
65
    }
66
}
67