MeSignupRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 34
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ofCustomer() 0 3 1
A __construct() 0 3 1
A httpRequest() 0 6 1
1
<?php
2
/**
3
 * @author @jenschude <[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
use Commercetools\Core\Model\MapperInterface;
16
17
/**
18
 * @package Commercetools\Core\Request\Me
19
 * @link https://docs.commercetools.com/http-api-projects-me-profile.html#create-customer-sign-up
20
 * @method CustomerSigninResult mapResponse(ApiResponseInterface $response)
21
 * @method CustomerSigninResult mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
22
 */
23
class MeSignupRequest extends AbstractCreateRequest
24
{
25
    protected $resultClass = CustomerSigninResult::class;
26
27
    /**
28
     * MeGetRequest constructor.
29
     * @param MyCustomerDraft $customer
30
     * @param Context $context
31
     */
32
    public function __construct(MyCustomerDraft $customer, Context $context = null)
33
    {
34
        parent::__construct(MeEndpoint::endpoint(), $customer, $context);
35
    }
36
37
    /**
38
     * @param MyCustomerDraft $customer
39
     * @param Context $context
40
     * @return static
41
     */
42
    public static function ofCustomer(MyCustomerDraft $customer, Context $context = null)
43
    {
44
        return new static($customer, $context);
45
    }
46
47
    /**
48
     * @return HttpRequest
49
     * @internal
50
     */
51
    public function httpRequest()
52
    {
53
        return new HttpRequest(
54
            HttpMethod::POST,
55
            (string)$this->getEndpoint() . '/signup' . $this->getParamString(),
56
            $this->getObject()
57
        );
58
    }
59
}
60