Passed
Pull Request — master (#23)
by
unknown
03:45
created

AkismetTestService::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\Akismet\Tests;
4
5
use Exception;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\Akismet\Service\AkismetService;
8
9
class AkismetTestService implements TestOnly, AkismetService
10
{
11
    public function __construct($apiKey, $url)
0 ignored issues
show
Unused Code introduced by
The parameter $url is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

11
    public function __construct($apiKey, /** @scrutinizer ignore-unused */ $url)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13
        if ($apiKey !== 'dummykey') {
14
            throw new Exception("Invalid key");
15
        }
16
    }
17
    
18
    public function isSpam($content, $author = null, $email = null, $url = null, $permalink = null, $type = null)
19
    {
20
        // This dummy service only checks the content
21
        return $content === 'spam';
22
    }
23
}
24