Issues (16)

tests/Model/CommentNotifiableTestDataObject.php (8 issues)

1
<?php
2
3
namespace SilverStripe\CommentNotifications\Tests\Model;
4
5
use SilverStripe\ORM\DataObject;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\Control\Controller;
8
use SilverStripe\Control\Director;
9
use SilverStripe\CommentNotifications\Extensions\CommentNotifiable;
10
use SilverStripe\Comments\Extensions\CommentsExtension;
11
12
class CommentNotifiableTestDataObject extends DataObject implements TestOnly
13
{
14
    private static $db = [
0 ignored issues
show
The private property $db is not used, and could be removed.
Loading history...
15
        "Title" => "Varchar(255)",
16
        "URLSegment" => "Varchar(255)",
17
    ];
18
19
    private static $has_one = [
0 ignored issues
show
The private property $has_one is not used, and could be removed.
Loading history...
20
        'Author' => 'SilverStripe\Security\Member'
21
    ];
22
23
    private static $extensions = [
0 ignored issues
show
The private property $extensions is not used, and could be removed.
Loading history...
24
        CommentNotifiable::class,
25
        CommentsExtension::class
26
    ];
27
28
    private static $table_name = 'CommentNotifiableTestDataObject';
0 ignored issues
show
The private property $table_name is not used, and could be removed.
Loading history...
29
30
    public function updateNotificationRecipients(&$list, $comment)
0 ignored issues
show
The parameter $comment 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

30
    public function updateNotificationRecipients(&$list, /** @scrutinizer ignore-unused */ $comment)

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...
31
    {
32
        $author = $this->Author();
0 ignored issues
show
The method Author() does not exist on SilverStripe\CommentNoti...otifiableTestDataObject. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

32
        /** @scrutinizer ignore-call */ 
33
        $author = $this->Author();
Loading history...
33
34
        if ($author && $author->exists()) {
35
            $list[] = $author->Email;
36
        }
37
    }
38
39
    public function Link($action = false)
0 ignored issues
show
The parameter $action 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

39
    public function Link(/** @scrutinizer ignore-unused */ $action = false)

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...
40
    {
41
        return Controller::join_links(
42
            Director::baseURL(),
43
            $this->URLSegment
0 ignored issues
show
Bug Best Practice introduced by
The property URLSegment does not exist on SilverStripe\CommentNoti...otifiableTestDataObject. Since you implemented __get, consider adding a @property annotation.
Loading history...
44
        );
45
    }
46
}
47