Completed
Push — develop ( e77623...3cc0f7 )
by Jens
09:01
created

MyCustomerDraft::ofEmailNameAndPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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