Completed
Push — master ( 1d95d9...41eac6 )
by Gilmar
21:32
created

Manager::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of gpupo/netshoes-sdk
5
 * Created by Gilmar Pupo <[email protected]>
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 * For more information, see <http://www.g1mr.com/>.
9
 */
10
namespace Gpupo\NetshoesSdk\Entity\Product\Sku;
11
12
use Gpupo\CommonSdk\Entity\EntityInterface;
13
use Gpupo\NetshoesSdk\Entity\ManagerAbstract;
14
15 View Code Duplication
class Manager extends ManagerAbstract
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
18
    protected $entity = 'Product';
19
20
    protected $maps = [
21
        'save'     => ['POST', '/products'],
22
        'findById' => ['GET', '/products/{itemId}'],
23
        'patch'    => ['PATCH', '/products/{itemId}'],
24
        'update'   => ['PUT', '/products/{itemId}'],
25
        'fetch'    => ['GET', '/products?page={offset}&size={limit}'],
26
    ];
27
28
    public function save(EntityInterface $product, $route = 'save')
29
    {
30
        return $this->execute($this->factoryMap('save'), $product->toJson());
31
    }
32
33
    protected function getMap($route, Product $product)
34
    {
35
        return $this->factoryMap($route, ['itemId' => $product->getId()]);
36
    }
37
38
}
39