ViewableTestObject   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParentPage() 0 3 1
A getViewAction() 0 3 1
1
<?php
2
3
namespace Dynamic\ViewableDataObject\Test\TestOnly;
4
5
use Dynamic\ViewableDataObject\Extensions\ViewableDataObject;
6
use Dynamic\ViewableDataObject\VDOInterfaces\ViewableDataObjectInterface;
7
use SilverStripe\Dev\TestOnly;
8
use SilverStripe\ORM\DataObject;
9
10
class ViewableTestObject extends DataObject implements TestOnly, ViewableDataObjectInterface
11
{
12
    /**
13
     * @var array
14
     */
15
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
16
        'Title' => 'Varchar(255)',
17
        'Content' => 'HTMLText',
18
    ];
19
20
    /**
21
     * @var string
22
     */
23
    private static $table_name = 'ViewableTestObject';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
24
25
    /**
26
     * @var array
27
     */
28
    private static $extensions = [
0 ignored issues
show
introduced by
The private property $extensions is not used, and could be removed.
Loading history...
29
        ViewableDataObject::class,
30
    ];
31
32
    /**
33
     * @return DataObject
34
     */
35
    public function getParentPage()
36
    {
37
        return \Page::get()->first();
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getViewAction()
44
    {
45
        return 'view';
46
    }
47
}
48