Issues (44)

php/Controller/AssetAdminTest/FileExtension.php (1 issue)

Severity
1
<?php
2
3
namespace SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\ORM\DataExtension;
7
8
/**
9
 * @skipUpgrade
10
 */
11
class FileExtension extends DataExtension implements TestOnly
12
{
13
    public function canView($member = null)
0 ignored issues
show
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

13
    public function canView(/** @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...
14
    {
15
        if ($this->owner->Name === 'disallowCanView.txt') {
16
            return false;
17
        }
18
    }
19
20
    public function canEdit($member = null)
21
    {
22
        if ($this->owner->Name === 'disallowCanEdit.txt') {
23
            return false;
24
        }
25
    }
26
27
    public function canDelete($member = null)
28
    {
29
        if ($this->owner->Name === 'disallowCanDelete.txt') {
30
            return false;
31
        }
32
    }
33
34
    public function canArchive($member = null)
35
    {
36
        if ($this->owner->Name === 'disallowCanDelete.txt') {
37
            return false;
38
        }
39
        return $this->owner->canDelete($member);
40
    }
41
42
43
    public function canCreate($member = null, $context = [])
44
    {
45
        if (isset($context['Parent']) && $context['Parent']->Name === 'disallowCanAddChildren') {
46
            return false;
47
        }
48
        if (isset($context['Upload']['name']) && $context['Upload']['name'] === 'disallowCanCreate.txt') {
49
            return false;
50
        }
51
    }
52
}
53