Completed
Push — master ( 0513f3...46cdfb )
by Daniel
03:05
created

Method   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 9
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 80
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A serialize() 0 8 1
A unserialize() 0 7 1
A getId() 0 4 1
A setId() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getParams() 0 4 1
A setParams() 0 4 1
1
<?php
2
3
namespace Cmobi\RabbitmqBundle\Routing;
4
5
class Method implements \Serializable
6
{
7
8
    private $id;
9
    private $name;
10
    private $params;
11
12
    public function __construct($id, $name, array $params = [])
13
    {
14
        $this->id = $id;
15
        $this->name = $name;
16
        $this->params = $params;
17
    }
18
19
20
    public function serialize()
21
    {
22
        return serialize([
23
           'id' => $this->getId(),
24
            'name' => $this->getName(),
25
            'params' => $this->getParams()
26
        ]);
27
    }
28
29
    public function unserialize($serialized)
30
    {
31
        $data = unserialize($serialized);
32
        $this->setId($data['id']);
33
        $this->setName($data['name']);
34
        $this->setParams($data['params']);
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getId()
41
    {
42
        return $this->id;
43
    }
44
45
    /**
46
     * @param string $id
47
     */
48
    public function setId($id)
49
    {
50
        $this->id = $id;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getName()
57
    {
58
        return $this->name;
59
    }
60
61
    /**
62
     * @param string $name
63
     */
64
    public function setName($name)
65
    {
66
        $this->name = $name;
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getParams()
73
    {
74
        return $this->params;
75
    }
76
77
    /**
78
     * @param array $params
79
     */
80
    public function setParams(array $params)
81
    {
82
        $this->params = $params;
83
    }
84
}