Completed
Push — develop ( 17c567...8b47e8 )
by Jens
08:20
created

MyCustomerDraft::setLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 * @created: 11.02.15, 14:23
5
 */
6
7
namespace Commercetools\Core\Model\Customer;
8
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Model\Common\JsonObject;
11
use Commercetools\Core\Model\Common\DateTimeDecorator;
12
use Commercetools\Core\Model\Common\LocaleTrait;
13
use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
14
use Commercetools\Core\Model\Common\AddressCollection;
15
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
16
use Commercetools\Core\Model\Common\DateDecorator;
17
18
/**
19
 * @package Commercetools\Core\Model\Customer
20
 * @link https://dev.commercetools.com/http-api-projects-me-profile.html#mycustomerdraft
21
 * @method string getEmail()
22
 * @method MyCustomerDraft setEmail(string $email = null)
23
 * @method string getPassword()
24
 * @method MyCustomerDraft setPassword(string $password = null)
25
 * @method string getFirstName()
26
 * @method MyCustomerDraft setFirstName(string $firstName = null)
27
 * @method string getMiddleName()
28
 * @method MyCustomerDraft setMiddleName(string $middleName = null)
29
 * @method string getLastName()
30
 * @method MyCustomerDraft setLastName(string $lastName = null)
31
 * @method string getTitle()
32
 * @method MyCustomerDraft setTitle(string $title = null)
33
 * @method DateDecorator getDateOfBirth()
34
 * @method MyCustomerDraft setDateOfBirth(\DateTime $dateOfBirth = null)
35
 * @method string getCompanyName()
36
 * @method MyCustomerDraft setCompanyName(string $companyName = null)
37
 * @method string getVatId()
38
 * @method MyCustomerDraft setVatId(string $vatId = null)
39
 * @method AddressCollection getAddresses()
40
 * @method MyCustomerDraft setAddresses(AddressCollection $addresses = null)
41
 * @method int getDefaultShippingAddress()
42
 * @method MyCustomerDraft setDefaultShippingAddress(int $defaultShippingAddress = null)
43
 * @method int getDefaultBillingAddress()
44
 * @method MyCustomerDraft setDefaultBillingAddress(int $defaultBillingAddress = null)
45
 * @method CustomFieldObjectDraft getCustom()
46
 * @method MyCustomerDraft setCustom(CustomFieldObjectDraft $custom = null)
47
 * @method string getLocale()
48
 */
49
class MyCustomerDraft extends JsonObject
50
{
51
    use LocaleTrait;
52
53
    public function fieldDefinitions()
54
    {
55
        return [
56
            'email' => [static::TYPE => 'string'],
57
            'password' => [static::TYPE => 'string'],
58
            'firstName' => [static::TYPE => 'string'],
59
            'middleName' => [static::TYPE => 'string'],
60
            'lastName' => [static::TYPE => 'string'],
61
            'title' => [static::TYPE => 'string'],
62
            'dateOfBirth' => [
63
                static::TYPE => '\DateTime',
64
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateDecorator'
65
            ],
66
            'companyName' => [static::TYPE => 'string'],
67
            'vatId' => [static::TYPE => 'string'],
68
            'addresses' => [static::TYPE => '\Commercetools\Core\Model\Common\AddressCollection'],
69
            'defaultShippingAddress' => [static::TYPE => 'int'],
70
            'defaultBillingAddress' => [static::TYPE => 'int'],
71
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
72
            'locale' => [static::TYPE => 'string'],
73
        ];
74
    }
75
76
    /**
77
     * @param string $email
78
     * @param string $firstName
79
     * @param string $lastName
80
     * @param string $password
81
     * @param Context|callable $context
82
     * @return CustomerDraft
83
     */
84 View Code Duplication
    public static function ofEmailNameAndPassword($email, $firstName, $lastName, $password, $context = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
    {
86
        $draft = static::of($context);
87
        return $draft->setEmail($email)
88
            ->setFirstName($firstName)
89
            ->setLastName($lastName)
90
            ->setPassword($password);
91
    }
92
}
93