Passed
Push — master ( e7fd69...83b0fe )
by Nicolaas
04:25
created

CMSNicetiesFormFieldExtension::AddToRightTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Sunnysideup\CMSNiceties\Extensions;
4
5
use SilverStripe\Core\Extension;
6
7
class CMSNicetiesFormFieldExtension extends Extension
8
{
9
10
    public function AddToDescription(string $description)
11
    {
12
        $owner = $this->getOwner();
13
        $descriptionArray = [$owner->getDescription()];
14
        $descriptionArray[] = $description;
15
        return $owner->setDescription(implode('<br />', array_filter($descriptionArray)));
16
    }
17
18
    public function AddToRightTitle(string $description)
19
    {
20
        $owner = $this->getOwner();
21
        $descriptionArray = [$owner->getRightTitle()];
22
        $descriptionArray[] = $description;
23
        return $owner->setRightTitle(implode('<br />', array_filter($descriptionArray)));
24
    }
25
26
    public function AddToLeftTitle(string $description)
27
    {
28
        $owner = $this->getOwner();
29
        $descriptionArray = [$owner->getLeftTitle()];
30
        $descriptionArray[] = $description;
31
        return $owner->setLeftTitle(implode('<br />', array_filter($descriptionArray)));
32
    }
33
}
34