Completed
Push — develop ( b37c60...7b776f )
by
unknown
42:54 queued 11:25
created

Customer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 3
c 4
b 0
f 3
lcom 1
cbo 2
dl 0
loc 48
ccs 33
cts 33
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
B fieldDefinitions() 0 35 1
A getDefaultShippingAddress() 0 4 1
A getDefaultBillingAddress() 0 4 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Customer;
7
8
use Commercetools\Core\Model\Common\AddressCollection;
9
use Commercetools\Core\Model\Common\Resource;
10
use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
11
use Commercetools\Core\Model\CustomField\CustomFieldObject;
12
use Commercetools\Core\Model\Common\DateTimeDecorator;
13
14
/**
15
 * @package Commercetools\Core\Model\Customer
16
 * @apidoc http://dev.sphere.io/http-api-projects-customers.html#customer
17
 * @method string getId()
18
 * @method Customer setId(string $id = null)
19
 * @method int getVersion()
20
 * @method Customer setVersion(int $version = null)
21
 * @method string getCustomerNumber()
22
 * @method Customer setCustomerNumber(string $customerNumber = null)
23
 * @method DateTimeDecorator getCreatedAt()
24
 * @method Customer setCreatedAt(\DateTime $createdAt = null)
25
 * @method DateTimeDecorator getLastModifiedAt()
26
 * @method Customer setLastModifiedAt(\DateTime $lastModifiedAt = null)
27
 * @method string getEmail()
28
 * @method Customer setEmail(string $email = null)
29
 * @method string getFirstName()
30
 * @method Customer setFirstName(string $firstName = null)
31
 * @method string getLastName()
32
 * @method Customer setLastName(string $lastName = null)
33
 * @method string getPassword()
34
 * @method Customer setPassword(string $password = null)
35
 * @method string getMiddleName()
36
 * @method Customer setMiddleName(string $middleName = null)
37
 * @method string getTitle()
38
 * @method Customer setTitle(string $title = null)
39
 * @method DateTimeDecorator getDateOfBirth()
40
 * @method Customer setDateOfBirth(\DateTime $dateOfBirth = null)
41
 * @method string getCompanyName()
42
 * @method Customer setCompanyName(string $companyName = null)
43
 * @method string getVatId()
44
 * @method Customer setVatId(string $vatId = null)
45
 * @method AddressCollection getAddresses()
46
 * @method Customer setAddresses(AddressCollection $addresses = null)
47
 * @method string getDefaultShippingAddressId()
48
 * @method Customer setDefaultShippingAddressId(string $defaultShippingAddressId = null)
49
 * @method string getDefaultBillingAddressId()
50
 * @method Customer setDefaultBillingAddressId(string $defaultBillingAddressId = null)
51
 * @method bool getIsEmailVerified()
52
 * @method Customer setIsEmailVerified(bool $isEmailVerified = null)
53
 * @method string getExternalId()
54
 * @method Customer setExternalId(string $externalId = null)
55
 * @method CustomerGroupReference getCustomerGroup()
56
 * @method Customer setCustomerGroup(CustomerGroupReference $customerGroup = null)
57
 * @method CustomFieldObject getCustom()
58
 * @method Customer setCustom(CustomFieldObject $custom = null)
59
 */
60
class Customer extends Resource
61
{
62 5
    public function fieldDefinitions()
63
    {
64
        return [
65 5
            'id' => [static::TYPE => 'string'],
66 5
            'version' => [static::TYPE => 'int'],
67 5
            'customerNumber' => [static::TYPE => 'string'],
68
            'createdAt' => [
69 5
                static::TYPE => '\DateTime',
70 5
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
71 5
            ],
72
            'lastModifiedAt' => [
73 5
                static::TYPE => '\DateTime',
74 5
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
75 5
            ],
76 5
            'email' => [static::TYPE => 'string'],
77 5
            'firstName' => [static::TYPE => 'string'],
78 5
            'lastName' => [static::TYPE => 'string'],
79 5
            'password' => [static::TYPE => 'string'],
80 5
            'middleName' => [static::TYPE => 'string'],
81 5
            'title' => [static::TYPE => 'string'],
82
            'dateOfBirth' => [
83 5
                static::TYPE => '\DateTime',
84 5
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
85 5
            ],
86 5
            'companyName' => [static::TYPE => 'string'],
87 5
            'vatId' => [static::TYPE => 'string'],
88 5
            'addresses' => [static::TYPE => '\Commercetools\Core\Model\Common\AddressCollection'],
89 5
            'defaultShippingAddressId' => [static::TYPE => 'string'],
90 5
            'defaultBillingAddressId' => [static::TYPE => 'string'],
91 5
            'isEmailVerified' => [static::TYPE => 'bool'],
92 5
            'externalId' => [static::TYPE => 'string'],
93 5
            'customerGroup' => [static::TYPE => '\Commercetools\Core\Model\CustomerGroup\CustomerGroupReference'],
94 5
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
95 5
        ];
96
    }
97
98 1
    public function getDefaultShippingAddress()
99
    {
100 1
        return $this->getAddresses()->getById($this->getDefaultShippingAddressId());
101
    }
102
103 1
    public function getDefaultBillingAddress()
104
    {
105 1
        return $this->getAddresses()->getById($this->getDefaultBillingAddressId());
106
    }
107
}
108