Passed
Push — feature/Logging ( 77a350...d4b3c6 )
by Simon
05:26
created

SolrLog::canView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Models;
5
6
use SilverStripe\Control\Director;
7
use SilverStripe\ORM\DataObject;
8
use SilverStripe\Security\Member;
9
10
/**
11
 * Class \Firesphere\SolrSearch\Models\SolrError
12
 *
13
 * @property string $Message
14
 * @property string $Index
15
 */
16
class SolrLog extends DataObject
17
{
18
    private static $table_name = 'SolrLog';
19
20
    private static $db = [
21
        'Timestamp' => 'Varchar(50)',
22
        'Message'   => 'Text',
23
        'Index'     => 'Varchar(255)',
24
        'Type'      => 'Enum("Config,Index,Query")',
25
        'Level'     => 'Varchar(10)'
26
    ];
27
28
    private static $summary_fields = [
1 ignored issue
show
introduced by
The private property $summary_fields is not used, and could be removed.
Loading history...
29
        'Created',
30
        'Index',
31
        'Type'
32
    ];
33
34
    private static $indexes = [
1 ignored issue
show
introduced by
The private property $indexes is not used, and could be removed.
Loading history...
35
        'Timestamp' => true,
36
    ];
37
38
    private static $sort = 'Created DESC';
1 ignored issue
show
introduced by
The private property $sort is not used, and could be removed.
Loading history...
39
40
    /**
41
     * @param null|Member $member
42
     * @return bool|mixed
43
     */
44
    public function canCreate($member = null, $context = [])
45
    {
46
        return false;
47
    }
48
49
    /**
50
     * @param null|Member $member
51
     * @return bool|mixed
52
     */
53
    public function canEdit($member = null)
54
    {
55
        return false;
56
    }
57
58
    /**
59
     * @param null|Member $member
60
     * @return bool|mixed
61
     */
62
    public function canView($member = null)
63
    {
64
        return parent::canView($member); // TODO: Change the autogenerated stub
65
    }
66
67
    /**
68
     * @param null|Member $member
69
     * @return bool|mixed
70
     */
71
    public function canDelete($member = null)
72
    {
73
        return $member->inGroup('administrators') || Director::isDev();
0 ignored issues
show
Bug introduced by
The method inGroup() does not exist on null. ( Ignorable by Annotation )

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

73
        return $member->/** @scrutinizer ignore-call */ inGroup('administrators') || Director::isDev();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
74
    }
75
}
76