Completed
Push — master ( 7656e3...56814f )
by Tobias
05:58
created

EditInPlaceMessage::setKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\Model;
13
14
use Symfony\Component\Validator\Constraints as Assert;
15
use Translation\Common\Model\Message;
16
17
/**
18
 * @author Damien Alexandre <[email protected]>
19
 */
20
final class EditInPlaceMessage
21
{
22
    /**
23
     * @var string
24
     * @Assert\NotBlank(groups={"Create", "Edit", "Delete"})
25
     */
26
    private $key;
27
28
    /**
29
     * @var string
30
     * @Assert\NotBlank(groups={"Create", "Edit"})
31
     */
32
    private $message;
33
34
    /**
35
     * @var string
36
     * @Assert\NotBlank(groups={"Create", "Edit", "Delete"})
37
     */
38
    private $domain;
39
40
    /**
41
     * Convert to a Common\Message.
42
     *
43
     * @param string $locale
44
     *
45
     * @return Message
46
     */
47
    public function convertToMessage($locale)
48
    {
49
        return new Message(
50
            $this->key,
51
            $this->domain,
52
            $locale,
53
            $this->message
54
        );
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getKey()
61
    {
62
        return $this->key;
63
    }
64
65
    /**
66
     * @param string $key
67
     *
68
     * @return EditInPlaceMessage
69
     */
70
    public function setKey($key)
71
    {
72
        $this->key = $key;
73
74
        return $this;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getMessage()
81
    {
82
        return $this->message;
83
    }
84
85
    /**
86
     * @param string $message
87
     *
88
     * @return EditInPlaceMessage
89
     */
90
    public function setMessage($message)
91
    {
92
        $this->message = $message;
93
94
        return $this;
95
    }
96
97
    /**
98
     * @return string
99
     */
100
    public function getDomain()
101
    {
102
        return $this->domain;
103
    }
104
105
    /**
106
     * @param string $domain
107
     *
108
     * @return EditInPlaceMessage
109
     */
110
    public function setDomain($domain)
111
    {
112
        $this->domain = $domain;
113
114
        return $this;
115
    }
116
}
117