Completed
Branch master (9c37c7)
by Jens
07:29
created

ChannelCreateRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ofDraft() 0 4 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Channels;
7
8
use Commercetools\Core\Model\Channel\ChannelDraft;
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Request\AbstractCreateRequest;
11
use Commercetools\Core\Model\Channel\Channel;
12
use Commercetools\Core\Response\ApiResponseInterface;
13
14
/**
15
 * @package Commercetools\Core\Request\Channels
16
 * @link https://dev.commercetools.com/http-api-projects-channels.html#create-channel
17
 * @method Channel mapResponse(ApiResponseInterface $response)
18
 */
19
class ChannelCreateRequest extends AbstractCreateRequest
20
{
21
    protected $resultClass = '\Commercetools\Core\Model\Channel\Channel';
22
23
    /**
24
     * @param ChannelDraft $channel
25
     * @param Context $context
26
     */
27 14
    public function __construct(ChannelDraft $channel, Context $context = null)
28
    {
29 14
        parent::__construct(ChannelsEndpoint::endpoint(), $channel, $context);
30 14
    }
31
32
    /**
33
     * @param ChannelDraft $channel
34
     * @param Context $context
35
     * @return static
36
     */
37 14
    public static function ofDraft(ChannelDraft $channel, Context $context = null)
38
    {
39 14
        return new static($channel, $context);
40
    }
41
}
42