Passed
Push — master ( 6cf7a4...717b12 )
by Robbie
03:33
created
src/Tasks/CurlLinkChecker.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -11,81 +11,81 @@
 block discarded – undo
11 11
  */
12 12
 class CurlLinkChecker implements LinkChecker
13 13
 {
14
-    use Configurable;
14
+	use Configurable;
15 15
 
16
-    /**
17
-     * If we want to follow redirects a 301 http code for example
18
-     * Set via YAML file
19
-     *
20
-     * @config
21
-     * @var boolean
22
-     */
23
-    private static $follow_location = false;
16
+	/**
17
+	 * If we want to follow redirects a 301 http code for example
18
+	 * Set via YAML file
19
+	 *
20
+	 * @config
21
+	 * @var boolean
22
+	 */
23
+	private static $follow_location = false;
24 24
 
25
-    /**
26
-     * If we want to bypass the cache
27
-     * Set via YAML file
28
-     *
29
-     * @config
30
-     * @var boolean
31
-     */
32
-    private static $bypass_cache = false;
25
+	/**
26
+	 * If we want to bypass the cache
27
+	 * Set via YAML file
28
+	 *
29
+	 * @config
30
+	 * @var boolean
31
+	 */
32
+	private static $bypass_cache = false;
33 33
 
34
-    /**
35
-     * Return cache
36
-     *
37
-     * @return CacheInterface
38
-     */
39
-    protected function getCache()
40
-    {
41
-        return Injector::inst()->get(CacheInterface::class . '.CurlLinkChecker');
42
-    }
34
+	/**
35
+	 * Return cache
36
+	 *
37
+	 * @return CacheInterface
38
+	 */
39
+	protected function getCache()
40
+	{
41
+		return Injector::inst()->get(CacheInterface::class . '.CurlLinkChecker');
42
+	}
43 43
 
44
-    /**
45
-     * Determine the http status code for a given link
46
-     *
47
-     * @param string $href URL to check
48
-     * @return int HTTP status code, or null if not checkable (not a link)
49
-     */
50
-    public function checkLink($href)
51
-    {
52
-        // Skip non-external links
53
-        if (!preg_match('/^https?[^:]*:\/\//', $href)) {
54
-            return null;
55
-        }
44
+	/**
45
+	 * Determine the http status code for a given link
46
+	 *
47
+	 * @param string $href URL to check
48
+	 * @return int HTTP status code, or null if not checkable (not a link)
49
+	 */
50
+	public function checkLink($href)
51
+	{
52
+		// Skip non-external links
53
+		if (!preg_match('/^https?[^:]*:\/\//', $href)) {
54
+			return null;
55
+		}
56 56
 
57
-        if (!$this->config()->get('bypass_cache')) {
58
-            // Check if we have a cached result
59
-            $cacheKey = md5($href);
60
-            $result = $this->getCache()->load($cacheKey);
61
-            if ($result !== false) {
62
-                return $result;
63
-            }
64
-        }
57
+		if (!$this->config()->get('bypass_cache')) {
58
+			// Check if we have a cached result
59
+			$cacheKey = md5($href);
60
+			$result = $this->getCache()->load($cacheKey);
61
+			if ($result !== false) {
62
+				return $result;
63
+			}
64
+		}
65 65
 
66
-        // Check if we have a cached result
67
-        $cacheKey = md5($href);
68
-        $result = $this->getCache()->get($cacheKey, false);
69
-        if ($result !== false) {
70
-            return $result;
71
-        }
66
+		// Check if we have a cached result
67
+		$cacheKey = md5($href);
68
+		$result = $this->getCache()->get($cacheKey, false);
69
+		if ($result !== false) {
70
+			return $result;
71
+		}
72 72
 
73
-        // No cached result so just request
74
-        $handle = curl_init($href);
75
-        curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
76
-        if ($this->config()->get('follow_location')) {
77
-            curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
78
-        }
79
-        curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
80
-        curl_setopt($handle, CURLOPT_TIMEOUT, 10);
81
-        curl_exec($handle);
82
-        $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
83
-        curl_close($handle);
73
+		// No cached result so just request
74
+		$handle = curl_init($href);
75
+		curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
76
+		if ($this->config()->get('follow_location')) {
77
+			curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
78
+		}
79
+		curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
80
+		curl_setopt($handle, CURLOPT_TIMEOUT, 10);
81
+		curl_exec($handle);
82
+		$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
83
+		curl_close($handle);
84 84
 
85
-        if (!$this->config()->get('bypass_cache')) {
86
-            // Cache result
87
-            $this->getCache()->save($httpCode, $cacheKey);
88
-        }
89
-        return $httpCode;
90
-    }
85
+		if (!$this->config()->get('bypass_cache')) {
86
+			// Cache result
87
+			$this->getCache()->save($httpCode, $cacheKey);
88
+		}
89
+		return $httpCode;
90
+	}
91 91
 }
Please login to merge, or discard this patch.