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

ChannelCreateRequest::ofDraft()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 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