Passed
Pull Request — develop (#507)
by
unknown
15:33
created

ProductVariantImportDraft::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Order;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Common\PriceCollection;
11
use Commercetools\Core\Model\Common\AttributeCollection;
12
use Commercetools\Core\Model\Common\ImageCollection;
13
14
/**
15
 * @package Commercetools\Core\Model\Order
16
 * @link https://docs.commercetools.com/http-api-projects-orders-import.html#productvariantimportdraft
17
 * @method int getId()
18
 * @method ProductVariantImportDraft setId(int $id = null)
19
 * @method string getSku()
20
 * @method ProductVariantImportDraft setSku(string $sku = null)
21
 * @method PriceCollection getPrices()
22
 * @method ProductVariantImportDraft setPrices(PriceCollection $prices = null)
23
 * @method AttributeCollection getAttributes()
24
 * @method ProductVariantImportDraft setAttributes(AttributeCollection $attributes = null)
25
 * @method ImageCollection getImages()
26
 * @method ProductVariantImportDraft setImages(ImageCollection $images = null)
27
 */
28
class ProductVariantImportDraft extends JsonObject
29
{
30 10
    public function fieldDefinitions()
31
    {
32
        return [
33 10
            'id' => [static::TYPE => 'int'],
34 10
            'sku' => [static::TYPE => 'string'],
35 10
            'prices' => [static::TYPE => PriceCollection::class],
36 10
            'attributes' => [static::TYPE => AttributeCollection::class],
37 10
            'images' => [static::TYPE => ImageCollection::class],
38
        ];
39
    }
40
41
    /**
42
     * @param string $sku
43
     * @param Context|callable $context
44
     * @return ProductVariantImportDraft
45
     */
46 8
    public static function ofSku($sku, $context = null)
47
    {
48 8
        return static::of($context)->setSku($sku);
49
    }
50
}
51