Completed
Push — master ( a435b5...54b9b0 )
by Guillaume
14:56
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
10
class LeadManager extends AbstractManager
11
{
12
13
    public function getSupport(Entity $object)
14
    {
15
        return $object instanceof Lead;
16
    }
17
18
    /**
19
     * @param Entity $object
20
     * @throws DeleteObjectNotAllowedException
21
     */
22
    public function delete(Entity $object)
23
    {
24
        throw new DeleteObjectNotAllowedException();
25
    }
26
27
    public function toArray(Lead $object, $fields = [])
28
    {
29
        $array = [
30
            "id" => $object->getId(),
31
            "date_event" => $object->getDateEvent(),
32
            "origin" => $object->getOrigin(),
33
            "product" => $object->getProduct(),
34
            "external_reference" => $object->getExternalReference(),
35
            "pixel" => $object->getPixel(),
36
            "ip_address" => $object->getIpAddress(),
37
            "serialisation" => $object->getSerialisation(),
38
        ];
39
40
        return $this->exportFields($array, $fields);
41
    }
42
}
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...
43