GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ManagerAbstract   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 2
dl 0
loc 51
ccs 16
cts 18
cp 0.8889
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A fetchDefaultParameters() 0 8 1
A fetchPrepare() 0 6 2
A factoryEntityCollection() 0 4 1
A findById() 0 8 2
A update() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of gpupo/cnova-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 <https://opensource.gpupo.com/>.
13
 */
14
15
namespace Gpupo\CnovaSdk\Entity;
16
17
use Gpupo\CommonSdk\Entity\EntityInterface;
18
use Gpupo\CommonSdk\Entity\ManagerAbstract as CommonAbstract;
19
use Gpupo\CommonSdk\Entity\ManagerInterface;
20
21
abstract class ManagerAbstract extends CommonAbstract implements ManagerInterface
22
{
23 17
    protected function fetchDefaultParameters()
24
    {
25
        return [
26 17
            'status'     => '',
27
            'createdAt'  => '',
28
            'purchaseAt' => '',
29
        ];
30
    }
31
32
    /**
33
     * @return Gpupo\Common\Entity\CollectionAbstract|null
34
     */
35 17
    protected function fetchPrepare($data)
36
    {
37 17
        if (!empty($data)) {
38 17
            return $this->factoryEntityCollection($data);
39
        }
40
    }
41
42 17
    protected function factoryEntityCollection($data)
43
    {
44 17
        return $this->factoryNeighborObject($this->getEntityName().'Collection', $data);
45
    }
46
47
    /**
48
     * @return Gpupo\Common\Entity\CollectionAbstract|null
49
     */
50 4
    public function findById($itemId)
51
    {
52 4
        $data = parent::findById($itemId);
53
54 4
        if (!empty($data)) {
55 4
            return $this->factoryEntity($data->toArray());
56
        }
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 3
    public function update(EntityInterface $entity, EntityInterface $existent)
63
    {
64 3
        $text = 'Chamada a Atualização de entity '.$this->entity;
65
66 3
        return $this->log('debug', $text, [
67 3
            'entity'   => $entity,
68 3
            'existent' => $existent,
69
        ]);
70
    }
71
}
72