Completed
Push — master ( d72e6b...d34f34 )
by Gilmar
24:51
created

Product::toPatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of gpupo/netshoes-sdk
5
 * Created by Gilmar Pupo <[email protected]>
6
 * For the information of copyright and license you should read the file
7
 * LICENSE which is distributed with this source code.
8
 * Para a informação dos direitos autorais e de licença você deve ler o arquivo
9
 * LICENSE que é distribuído com este código-fonte.
10
 * Para obtener la información de los derechos de autor y la licencia debe leer
11
 * el archivo LICENSE que se distribuye con el código fuente.
12
 * For more information, see <http://www.g1mr.com/>.
13
 */
14
15
namespace Gpupo\NetshoesSdk\Entity\Product;
16
17
use Gpupo\CommonSdk\Entity\EntityAbstract;
18
use Gpupo\CommonSdk\Entity\EntityInterface;
19
20
/**
21
 * Product Entity.
22
 *
23
 * @method string getProductId()    Acesso a productId
24
 * @method setProductId(string $productId)    Define productId
25
 * @method Gpupo\NetshoesSdk\Entity\Product\Skus getSkus()    Acesso a skus
26
 * @method setSkus(Gpupo\NetshoesSdk\Entity\Product\Skus $skus)    Define skus
27
 * @method string getDepartment()    Acesso a department
28
 * @method setDepartment(string $department)    Define department
29
 * @method string getProductType()    Acesso a productType
30
 * @method setProductType(string $productType)    Define productType
31
 * @method string getBrand()    Acesso a brand
32
 * @method setBrand(string $brand)    Define brand
33
 * @method Gpupo\NetshoesSdk\Entity\Product\Attributes\Attributes getAttributes()    Acesso a attributes
34
 * @method setAttributes(Gpupo\NetshoesSdk\Entity\Product\Attributes\Attributes $attributes)    Define attributes
35
 */
36
final class Product extends EntityAbstract implements EntityInterface
37
{
38
    protected $primaryKey = 'productId';
39
40
    /**
41
     * @codeCoverageIgnore
42
     */
43
    public function getSchema()
44
    {
45
        return [
46
            'productId'   => 'string',
47
            'skus'        => 'object',
48
            'department'  => 'string',
49
            'productType' => 'string',
50
            'brand'       => 'string',
51
            'attributes'  => 'object',
52
        ];
53
    }
54
55 2
    public function toPatch(array $diff)
56
    {
57 2
        $diff[] = 'productId';
58
59 2
        return $this->partitionByArrayKey($diff);
60
    }
61
}
62