Message   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 51
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getTemplate() 0 4 1
A getParameters() 0 4 1
A getPluralization() 0 4 1
A __toString() 0 4 1
A serialize() 0 8 1
A unserialize() 0 8 1
1
<?php
2
3
namespace Knp\RadBundle\Flash;
4
5
class Message implements \Serializable
6
{
7
    private $template;
8
    private $parameters;
9
    private $pluralization;
10
11
    public function __construct($template, array $parameters = array(), $pluralization = null)
12
    {
13
        $this->template      = $template;
14
        $this->parameters    = $parameters;
15
        $this->pluralization = $pluralization;
16
    }
17
18
    public function getTemplate()
19
    {
20
        return $this->template;
21
    }
22
23
    public function getParameters()
24
    {
25
        return $this->parameters;
26
    }
27
28
    public function getPluralization()
29
    {
30
        return $this->pluralization;
31
    }
32
33
    public function __toString()
34
    {
35
        return strtr($this->template, $this->parameters);
36
    }
37
38
    public function serialize()
39
    {
40
        return serialize(array(
41
            $this->template,
42
            $this->parameters,
43
            $this->pluralization
44
        ));
45
    }
46
47
    public function unserialize($data)
48
    {
49
        list(
50
            $this->template,
51
            $this->parameters,
52
            $this->pluralization
53
        ) = unserialize($data);
54
    }
55
}
56