Completed
Pull Request — master (#8)
by Matthew
04:42
created

ElementSlideshow::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Dynamic\Elements\Flexslider\Elements;
4
5
use DNADesign\Elemental\Models\BaseElement;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\ORM\FieldType\DBField;
8
9
class ElementSlideshow extends BaseElement
10
{
11
    /**
12
     * @var string
13
     */
14
    private static $icon = 'slideshow-icon';
0 ignored issues
show
introduced by
The private property $icon is not used, and could be removed.
Loading history...
15
16
    /**
17
     * @var string
18
     */
19
    private static $singular_name = 'Flexslider Element';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
20
21
    /**
22
     * @var string
23
     */
24
    private static $plural_name = 'Flexslider Elements';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
25
26
    /**
27
     * @var string
28
     */
29
    private static $table_name = 'ElementSlideshow';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
30
31
    /**
32
     * @var array
33
     */
34
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
35
        'Content' => 'HTMLText',
36
    ];
37
38
    public function getCMSFields()
39
    {
40 1
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
41 1
            $fields->dataFieldByName('Content')
42 1
                ->setRows(8);
43 1
        });
44
45 1
        return parent::getCMSFields();
46
    }
47
48
    /**
49
     * @return HTMLText
0 ignored issues
show
Bug introduced by
The type Dynamic\Elements\Flexslider\Elements\HTMLText was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
50
     */
51 1
    public function ElementSummary()
52
    {
53 1
        return DBField::create_field('HTMLText', $this->Content)->Summary(20);
0 ignored issues
show
Bug Best Practice introduced by
The property Content does not exist on Dynamic\Elements\Flexsli...ements\ElementSlideshow. Since you implemented __get, consider adding a @property annotation.
Loading history...
54
    }
55
56
    /**
57
     * @return string
58
     */
59 1
    public function getType()
60
    {
61 1
        return _t(__CLASS__.'.BlockType', 'Slideshow');
62
    }
63
}
64