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

LeadManager::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 2
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