SimpleCompanyExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A IsIndividual() 0 3 1
A IsCompany() 0 3 1
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