Customer::invoiceDeliveredByEmail()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 2
eloc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Speicher210\Fastbill\Api\Model;
4
5
use JMS\Serializer\Annotation as JMS;
6
7
/**
8
 * Customer model.
9
 */
10
class Customer
11
{
12
    use CustomerTrait;
13
14
    const CUSTOMER_SALUTATION_NONE = '';
15
    const CUSTOMER_SALUTATION_MR = 'mr';
16
    const CUSTOMER_SALUTATION_MRS = 'mrs';
17
    const CUSTOMER_SALUTATION_FAMILY = 'family';
18
19
    const CUSTOMER_PAYMENT_TYPE_TRANSFER = 1;
20
    const CUSTOMER_PAYMENT_TYPE_DIRECT_DEBIT = 2;
21
    const CUSTOMER_PAYMENT_TYPE_CASH = 3;
22
    const CUSTOMER_PAYMENT_TYPE_PAYPAL = 4;
23
    const CUSTOMER_PAYMENT_TYPE_ADVANCED_PAYMENT = 5;
24
    const CUSTOMER_PAYMENT_TYPE_CREDIT_CARD = 6;
25
26
    const CUSTOMER_TYPE_BUSINESS = 'business';
27
    const CUSTOMER_TYPE_CONSUMER = 'consumer';
28
29
    const INVOICE_DELIVERY_METHOD_NONE = 'none';
30
    const INVOICE_DELIVERY_METHOD_MAIL = 'mail';
31
    const INVOICE_DELIVERY_METHOD_POST = 'post';
32
    const INVOICE_DELIVERY_METHOD_BOTH = 'both';
33
34
    /**
35
     * Check if the user is a consumer.
36
     *
37
     * @return boolean
38
     */
39
    public function isConsumer()
40
    {
41
        return $this->customerType === self::CUSTOMER_TYPE_CONSUMER;
42
    }
43
44
    /**
45
     * Check if the user is a business.
46
     *
47
     * @return boolean
48
     */
49
    public function isBusiness()
50
    {
51
        return $this->customerType === self::CUSTOMER_TYPE_BUSINESS;
52
    }
53
54
    /**
55
     * Check if the invoice is delivered by email (only by email or also by email).
56
     *
57
     * @return boolean
58
     */
59
    public function invoiceDeliveredByEmail()
60
    {
61
        return $this->invoiceDeliveryMethod === self::INVOICE_DELIVERY_METHOD_MAIL || $this->invoiceDeliveryMethod === self::INVOICE_DELIVERY_METHOD_BOTH;
62
    }
63
}
64