Passed
Pull Request — master (#27)
by
unknown
01:53
created
src/Model/BrokenExternalLink.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -18,68 +18,68 @@
 block discarded – undo
18 18
  */
19 19
 class BrokenExternalLink extends DataObject
20 20
 {
21
-    private static $table_name = 'BrokenExternalLink';
21
+	private static $table_name = 'BrokenExternalLink';
22 22
 
23
-    private static $db = array(
24
-        'Link' => 'Varchar(2083)', // 2083 is the maximum length of a URL in Internet Explorer.
25
-        'HTTPCode' =>'Int'
26
-    );
23
+	private static $db = array(
24
+		'Link' => 'Varchar(2083)', // 2083 is the maximum length of a URL in Internet Explorer.
25
+		'HTTPCode' =>'Int'
26
+	);
27 27
 
28
-    private static $has_one = array(
29
-        'Track' => BrokenExternalPageTrack::class,
30
-        'Status' => BrokenExternalPageTrackStatus::class
31
-    );
28
+	private static $has_one = array(
29
+		'Track' => BrokenExternalPageTrack::class,
30
+		'Status' => BrokenExternalPageTrackStatus::class
31
+	);
32 32
 
33
-    private static $summary_fields = array(
34
-        'Created' => 'Checked',
35
-        'Link' => 'External Link',
36
-        'HTTPCodeDescription' => 'HTTP Error Code',
37
-        'Page.Title' => 'Page link is on'
38
-    );
33
+	private static $summary_fields = array(
34
+		'Created' => 'Checked',
35
+		'Link' => 'External Link',
36
+		'HTTPCodeDescription' => 'HTTP Error Code',
37
+		'Page.Title' => 'Page link is on'
38
+	);
39 39
 
40
-    private static $searchable_fields = array(
41
-        'HTTPCode' => array('title' => 'HTTP Code')
42
-    );
40
+	private static $searchable_fields = array(
41
+		'HTTPCode' => array('title' => 'HTTP Code')
42
+	);
43 43
 
44
-    /**
45
-     * @return SiteTree
46
-     */
47
-    public function Page()
48
-    {
49
-        return $this->Track()->Page();
50
-    }
44
+	/**
45
+	 * @return SiteTree
46
+	 */
47
+	public function Page()
48
+	{
49
+		return $this->Track()->Page();
50
+	}
51 51
 
52
-    public function canEdit($member = false)
53
-    {
54
-        return false;
55
-    }
52
+	public function canEdit($member = false)
53
+	{
54
+		return false;
55
+	}
56 56
 
57
-    public function canView($member = false)
58
-    {
59
-        $member = $member ? $member : Member::currentUser();
60
-        $codes = array('content-authors', 'administrators');
61
-        return Permission::checkMember($member, $codes);
62
-    }
57
+	public function canView($member = false)
58
+	{
59
+		$member = $member ? $member : Member::currentUser();
60
+		$codes = array('content-authors', 'administrators');
61
+		return Permission::checkMember($member, $codes);
62
+	}
63 63
 
64
-    /**
65
-     * Retrieve a human readable description of a response code
66
-     *
67
-     * @return string
68
-     */
69
-    public function getHTTPCodeDescription()
70
-    {
71
-        $code = $this->HTTPCode;
64
+	/**
65
+	 * Retrieve a human readable description of a response code
66
+	 *
67
+	 * @return string
68
+	 */
69
+	public function getHTTPCodeDescription()
70
+	{
71
+		$code = $this->HTTPCode;
72 72
 
73
-        try {
74
-            $response = HTTPResponse::create('', $code);
75
-            // Assume that $code = 0 means there was no response
76
-            $description = $code ?
77
-                $response->getStatusDescription() :
78
-                _t(__CLASS__ . '.NOTAVAILABLE', 'Server Not Available');
79
-        } catch (InvalidArgumentException $e) {
80
-            $description = _t(__CLASS__ . '.UNKNOWNRESPONSE', 'Unknown Response Code');
81
-        }
73
+		try {
74
+			$response = HTTPResponse::create('', $code);
75
+			// Assume that $code = 0 means there was no response
76
+			$description = $code ?
77
+				$response->getStatusDescription() :
78
+				_t(__CLASS__ . '.NOTAVAILABLE', 'Server Not Available');
79
+		} catch (InvalidArgumentException $e) {
80
+			$description = _t(__CLASS__ . '.UNKNOWNRESPONSE', 'Unknown Response Code');
81
+		}
82 82
 
83
-        return sprintf("%d (%s)", $code, $description);
84
-    }
83
+		return sprintf("%d (%s)", $code, $description);
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,10 +74,9 @@
 block discarded – undo
74 74
             $response = HTTPResponse::create('', $code);
75 75
             // Assume that $code = 0 means there was no response
76 76
             $description = $code ?
77
-                $response->getStatusDescription() :
78
-                _t(__CLASS__ . '.NOTAVAILABLE', 'Server Not Available');
77
+                $response->getStatusDescription() : _t(__CLASS__.'.NOTAVAILABLE', 'Server Not Available');
79 78
         } catch (InvalidArgumentException $e) {
80
-            $description = _t(__CLASS__ . '.UNKNOWNRESPONSE', 'Unknown Response Code');
79
+            $description = _t(__CLASS__.'.UNKNOWNRESPONSE', 'Unknown Response Code');
81 80
         }
82 81
 
83 82
         return sprintf("%d (%s)", $code, $description);
Please login to merge, or discard this patch.
src/Controllers/CMSExternalLinksController.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -12,62 +12,62 @@
 block discarded – undo
12 12
 class CMSExternalLinksController extends Controller
13 13
 {
14 14
 
15
-    private static $allowed_actions = [
16
-        'getJobStatus',
17
-        'start'
18
-    ];
15
+	private static $allowed_actions = [
16
+		'getJobStatus',
17
+		'start'
18
+	];
19 19
 
20
-    /**
21
-     * Respond to Ajax requests for info on a running job
22
-     *
23
-     * @return string JSON string detailing status of the job
24
-     */
25
-    public function getJobStatus()
26
-    {
27
-        // Set headers
28
-        HTTP::set_cache_age(0);
29
-        HTTP::add_cache_headers($this->response);
30
-        $this->response
31
-            ->addHeader('Content-Type', 'application/json')
32
-            ->addHeader('Content-Encoding', 'UTF-8')
33
-            ->addHeader('X-Content-Type-Options', 'nosniff');
20
+	/**
21
+	 * Respond to Ajax requests for info on a running job
22
+	 *
23
+	 * @return string JSON string detailing status of the job
24
+	 */
25
+	public function getJobStatus()
26
+	{
27
+		// Set headers
28
+		HTTP::set_cache_age(0);
29
+		HTTP::add_cache_headers($this->response);
30
+		$this->response
31
+			->addHeader('Content-Type', 'application/json')
32
+			->addHeader('Content-Encoding', 'UTF-8')
33
+			->addHeader('X-Content-Type-Options', 'nosniff');
34 34
 
35
-        // Format status
36
-        $track = BrokenExternalPageTrackStatus::get_latest();
37
-        if ($track) {
38
-            return json_encode([
39
-                'TrackID' => $track->ID,
40
-                'Status' => $track->Status,
41
-                'Completed' => $track->getCompletedPages(),
42
-                'Total' => $track->getTotalPages()
43
-            ]);
44
-        }
45
-    }
35
+		// Format status
36
+		$track = BrokenExternalPageTrackStatus::get_latest();
37
+		if ($track) {
38
+			return json_encode([
39
+				'TrackID' => $track->ID,
40
+				'Status' => $track->Status,
41
+				'Completed' => $track->getCompletedPages(),
42
+				'Total' => $track->getTotalPages()
43
+			]);
44
+		}
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * Starts a broken external link check
50
-     */
51
-    public function start()
52
-    {
53
-        // return if the a job is already running
54
-        $status = BrokenExternalPageTrackStatus::get_latest();
55
-        if ($status && $status->Status == 'Running') {
56
-            return;
57
-        }
48
+	/**
49
+	 * Starts a broken external link check
50
+	 */
51
+	public function start()
52
+	{
53
+		// return if the a job is already running
54
+		$status = BrokenExternalPageTrackStatus::get_latest();
55
+		if ($status && $status->Status == 'Running') {
56
+			return;
57
+		}
58 58
 
59
-        // Create a new job
60
-        if (class_exists(QueuedJobService::class)) {
61
-            // Force the creation of a new run
62
-            BrokenExternalPageTrackStatus::create_status();
63
-            $checkLinks = new CheckExternalLinksJob();
64
-            singleton(QueuedJobService::class)->queueJob($checkLinks);
65
-        } else {
66
-            //TODO this hangs as it waits for the connection to be released
67
-            // should return back and continue processing
68
-            // http://us3.php.net/manual/en/features.connection-handling.php
69
-            $task = CheckExternalLinksTask::create();
70
-            $task->runLinksCheck();
71
-        }
72
-    }
59
+		// Create a new job
60
+		if (class_exists(QueuedJobService::class)) {
61
+			// Force the creation of a new run
62
+			BrokenExternalPageTrackStatus::create_status();
63
+			$checkLinks = new CheckExternalLinksJob();
64
+			singleton(QueuedJobService::class)->queueJob($checkLinks);
65
+		} else {
66
+			//TODO this hangs as it waits for the connection to be released
67
+			// should return back and continue processing
68
+			// http://us3.php.net/manual/en/features.connection-handling.php
69
+			$task = CheckExternalLinksTask::create();
70
+			$task->runLinksCheck();
71
+		}
72
+	}
73 73
 }
Please login to merge, or discard this patch.