Completed
Push — master ( f2ca5d...7b07ff )
by WEBEWEB
02:22
created

AbstractValidationStatus::getRuleName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2018 WEBEWEB
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 WBW\Library\Core\Validation\Status;
13
14
use WBW\Library\Core\Validation\API\ValidationStatusInterface;
15
16
/**
17
 * Abstract validation status.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Validation\Status
21
 * @abstract
22
 */
23
abstract class AbstractValidationStatus implements ValidationStatusInterface {
24
25
    /**
26
     * Get the code.
27
     *
28
     * @var int
29
     */
30
    private $code;
31
32
    /**
33
     * Message.
34
     *
35
     * @var string
36
     */
37
    private $message;
38
39
    /**
40
     * Rule name.
41
     *
42
     * @var string
43
     */
44
    private $ruleName;
45
46
    /**
47
     * Constructor.
48
     *
49
     * @param int $code The code.
50
     * @param string $message The message.
51
     */
52
    protected function __construct($code, $message) {
53
        $this->setCode($code);
54
        $this->setMessage($message);
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getCode() {
61
        return $this->code;
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function getMessage() {
68
        return $this->message;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getRuleName() {
75
        return $this->ruleName;
76
    }
77
78
    /**
79
     * Set the code.
80
     *
81
     * @param int $code The code.
82
     * @return ValidationStatusInterface Returns this validation status.
83
     */
84
    public function setCode($code) {
85
        $this->code = $code;
86
        return $this;
87
    }
88
89
    /**
90
     * Set the message.
91
     *
92
     * @param string $message The message.
93
     * @return ValidationStatusInterface Returns this validation status.
94
     */
95
    public function setMessage($message) {
96
        $this->message = $message;
97
        return $this;
98
    }
99
100
    /**
101
     * {@inheritdoc}
102
     */
103
    public function setRuleName($ruleName) {
104
        $this->ruleName = $ruleName;
105
        return $this;
106
    }
107
108
}
109