SimpleCompanyExtension::IsCompany()   A
last analyzed

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
namespace LeKoala\CommonExtensions;
4
5
use SilverStripe\ORM\DataExtension;
6
7
/**
8
 * A simple company extension for Member
9
 *
10
 * You might want to use a more complete company representation for situations where members can belong to multiple companies
11
 * or if you need more details about the company
12
 *
13
 * @property \LeKoala\CommonExtensions\SimpleCompanyExtension $owner
14
 * @property string $CompanyName
15
 * @property string $VatNumber
16
 */
17
class SimpleCompanyExtension extends DataExtension
18
{
19
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
20
        "CompanyName" => "Varchar(255)",
21
        "VatNumber" => "Varchar(255)",
22
    ];
23
24
    public function IsIndividual()
25
    {
26
        return $this->owner->CompanyName == '';
27
    }
28
29
    public function IsCompany()
30
    {
31
        return $this->owner->CompanyName != '';
32
    }
33
}
34