FileExtension::canEdit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace SilverStripe\AssetAdmin\Tests\Forms\FileFormBuilderTest;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\ORM\DataExtension;
7
8
/**
9
 * An extension to test file permissions
10
 * @package SilverStripe\AssetAdmin\Tests\Forms\FileFormBuilderTest
11
 */
12
class FileExtension extends DataExtension implements TestOnly
13
{
14
    // public flags to toggle permissions during tests
15
    public static $canDelete = false;
16
    public static $canPublish = true;
17
    public static $canUnpublish = true;
18
    public static $canEdit = true;
19
20
    public function canDelete($member)
21
    {
22
        return self::$canDelete;
23
    }
24
25
    public function canPublish($member = null)
0 ignored issues
show
Unused Code introduced by
The parameter $member 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

25
    public function canPublish(/** @scrutinizer ignore-unused */ $member = null)

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...
26
    {
27
        return self::$canPublish;
28
    }
29
30
    public function canUnpublish($member = null)
0 ignored issues
show
Unused Code introduced by
The parameter $member 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 canUnpublish(/** @scrutinizer ignore-unused */ $member = null)

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
        return self::$canUnpublish;
33
    }
34
35
    public function canEdit($member = null)
36
    {
37
        return self::$canEdit;
38
    }
39
}
40