Passed
Push — master ( 091915...c8a845 )
by Roman
03:50
created

TestDataObject   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 5 1
1
<?php
2
3
namespace Bummzack\SortableFile\Tests\Model;
4
5
use Bummzack\SortableFile\Forms\SortableUploadField;
6
use SilverStripe\Assets\File;
7
use SilverStripe\Dev\TestOnly;
8
use SilverStripe\Forms\FieldList;
9
use SilverStripe\ORM\DataObject;
10
11
class TestDataObject extends DataObject implements TestOnly
12
{
13
    private static $many_many = [
0 ignored issues
show
introduced by
The private property $many_many is not used, and could be removed.
Loading history...
14
        'Files' => File::class,
15
        'OtherFiles' => File::class
16
    ];
17
18
    private static $many_many_extraFields = [
0 ignored issues
show
introduced by
The private property $many_many_extraFields is not used, and could be removed.
Loading history...
19
        'Files' => [ 'SortOrder' => 'Int' ],
20
        'OtherFiles' => [ 'Sort' => 'Int' ]
21
    ];
22
23
    public function getCMSFields()
24
    {
25
        return FieldList::create(
26
            SortableUploadField::create('Files'),
0 ignored issues
show
Bug introduced by
'Files' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

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

26
            SortableUploadField::create(/** @scrutinizer ignore-type */ 'Files'),
Loading history...
27
            SortableUploadField::create('OtherFiles')->setSortColumn('Sort')
28
        );
29
    }
30
}
31