Rule::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Valid rule
4
 * User: moyo
5
 * Date: 2018/6/5
6
 * Time: 10:59 AM
7
 */
8
9
namespace Carno\Validator\Valid;
10
11
use Respect\Validation\Validator;
12
13
class Rule
14
{
15
    /**
16
     * @var string
17
     */
18
    private $field = null;
19
20
    /**
21
     * @var Validator
22
     */
23
    private $validator = null;
24
25
    /**
26
     * @var Message
27
     */
28
    private $message = null;
29
30
    /**
31
     * Rule constructor.
32
     * @param string $field
33
     * @param Validator $validator
34
     * @param Message $message
35
     */
36
    public function __construct(string $field, Validator $validator, Message $message)
37
    {
38
        $this->field = $field;
39
        $this->validator = $validator;
40
        $this->message = $message;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function f() : string
47
    {
48
        return $this->field;
49
    }
50
51
    /**
52
     * @return Validator
53
     */
54
    public function v() : Validator
55
    {
56
        return $this->validator;
57
    }
58
59
    /**
60
     * @return Message
61
     */
62
    public function e() : Message
63
    {
64
        return $this->message;
65
    }
66
}
67