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

MeSignupRequest::ofCustomer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
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 4
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Me;
7
8
use Commercetools\Core\Client\HttpMethod;
9
use Commercetools\Core\Client\HttpRequest;
10
use Commercetools\Core\Model\Common\Context;
11
use Commercetools\Core\Model\Customer\CustomerSigninResult;
12
use Commercetools\Core\Model\Customer\MyCustomerDraft;
13
use Commercetools\Core\Request\AbstractCreateRequest;
14
use Commercetools\Core\Response\ApiResponseInterface;
15
16
/**
17
 * @package Commercetools\Core\Request\Me
18
 * @method CustomerSigninResult mapResponse(ApiResponseInterface $response)
19
 */
20 View Code Duplication
class MeSignupRequest extends AbstractCreateRequest
0 ignored issues
show
Duplication introduced by
This class 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...
21
{
22
    protected $resultClass = '\Commercetools\Core\Model\Customer\CustomerSigninResult';
23
24
    /**
25
     * MeGetRequest constructor.
26
     * @param MyCustomerDraft $customer
27
     * @param Context $context
28
     */
29
    public function __construct(MyCustomerDraft $customer, Context $context = null)
30
    {
31
        parent::__construct(MeEndpoint::endpoint(), $customer, $context);
32
    }
33
34
    /**
35
     * @param MyCustomerDraft $customer
36
     * @param Context $context
37
     * @return static
38
     */
39
    public static function ofCustomer(MyCustomerDraft $customer, Context $context = null)
40
    {
41
        return new static($customer, $context);
42
    }
43
44
    /**
45
     * @return HttpRequest
46
     * @internal
47
     */
48
    public function httpRequest()
49
    {
50
        return new HttpRequest(
51
            HttpMethod::POST,
52
            (string)$this->getEndpoint() . '/signup' . $this->getParamString(),
53
            $this->getObject()
54
        );
55
    }
56
}
57