Passed
Push — master ( 177f69...7b0b69 )
by Simon
08:14
created

TestRelationObject   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFarmAnimals() 0 3 1
A getCow() 0 3 1
A canView() 0 3 1
A getSheep() 0 3 1
1
<?php
2
3
4
namespace Firesphere\SolrCompatibility\Tests;
5
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\ORM\DataObject;
8
9
class TestRelationObject extends DataObject implements TestOnly
10
{
11
    private static $db = [
12
        'Title' => 'Varchar(255)',
13
    ];
14
15
    private static $has_one = [
16
        'TestObject' => TestObject::class,
17
    ];
18
19
    public function canView($member = null)
20
    {
21
        return true;
22
    }
23
24
    public function getCow()
25
    {
26
        return $this->getFarmAnimals()[0];
27
    }
28
29
    public function getFarmAnimals()
30
    {
31
        return ['cow', 'sheep'];
32
    }
33
34
    public function getSheep()
35
    {
36
        return $this->getFarmAnimals()[1];
37
    }
38
}
39