Passed
Push — master ( 338501...d685f8 )
by Simon
14:58 queued 13:05
created

TestRelationObject::getFarmAnimals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace Firesphere\SolrSearch\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