Completed
Push — master ( 9ea506...789ce9 )
by Robbie
13s
created

PretendLinkChecker   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B checkLink() 0 18 10
1
<?php
2
namespace SilverStripe\ExternalLinks\Tests\Stubs;
3
4
use SilverStripe\ExternalLinks\Tasks\LinkChecker;
5
6
class PretendLinkChecker implements LinkChecker
7
{
8
    public function checkLink($href)
9
    {
10
        switch ($href) {
11
            case 'http://www.working.com':
12
                return 200;
13
            case 'http://www.broken.com':
14
                return 403;
15
            case 'http://www.nodomain.com':
16
                return 0;
17
            case '/internal/link':
18
            case '[sitetree_link,id=9999]':
19
            case 'home':
20
            case 'broken-internal':
21
            case '[sitetree_link,id=1]':
22
                return null;
23
            case 'http://www.broken.com/url/thing':
24
            default:
25
                return 404;
26
        }
27
    }
28
}
29