Completed
Push — master ( c5d644...a435b5 )
by Guillaume
02:45
created

LeadManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 43
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupport() 0 4 1
A delete() 0 4 1
A update() 0 4 1
A toArray() 0 15 1
1
<?php
2
3
namespace Starkerxp\LeadBundle\Manager;
4
5
use Starkerxp\LeadBundle\Entity\Lead;
6
use Starkerxp\StructureBundle\Entity\Entity;
7
use Starkerxp\StructureBundle\Manager\AbstractManager;
8
use Starkerxp\StructureBundle\Manager\Exception\DeleteObjectNotAllowedException;
9
use Starkerxp\StructureBundle\Manager\Exception\UpdateObjectNotAllowedException;
10
11
class LeadManager extends AbstractManager
12
{
13
14
    public function getSupport(Entity $object)
15
    {
16
        return $object instanceof Lead;
17
    }
18
19
    /**
20
     * @param Entity $object
21
     * @throws DeleteObjectNotAllowedException
22
     */
23
    public function delete(Entity $object)
24
    {
25
        throw new DeleteObjectNotAllowedException();
26
    }
27
28
    /**
29
     * @param Entity $object
30
     * @return bool|Entity|void
31
     * @throws UpdateObjectNotAllowedException
32
     */
33
    public function update(Entity $object)
34
    {
35
        throw new UpdateObjectNotAllowedException();
36
    }
37
38
    public function toArray(Lead $object, $fields = [])
39
    {
40
        $array = [
41
            "id"     => $object->getId(),
42
            "date_event"   => $object->getDateEvent(),
43
            "origin" => $object->getOrigin(),
44
            "product" => $object->getProduct(),
45
            "external_reference" => $object->getExternalReference(),
46
            "pixel" => $object->getPixel(),
47
            "ip_address" => $object->getIpAddress(),
48
            "serialisation" => $object->getSerialisation(),
49
        ];
50
51
        return $this->exportFields($array, $fields);
52
    }
53
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
54