Completed
Push — master ( 984d76...8152ca )
by WEBEWEB
04:38
created

AbstractValidationRule   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 36
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getName() 0 3 1
A setName() 0 4 1
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\Validator\Rule;
13
14
use WBW\Library\Core\Validator\API\ValidationRuleInterface;
15
16
/**
17
 * Abstract validation rule.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Validator\Rule
21
 * @abstract
22
 */
23
abstract class AbstractValidationRule implements ValidationRuleInterface {
24
25
    /**
26
     * Name.
27
     *
28
     * @var string
29
     */
30
    private $name;
31
32
    /**
33
     * Constructor.
34
     *
35
     * @param string $name The name.
36
     */
37
    protected function __construct($name) {
38
        $this->setName($name);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getName() {
45
        return $this->name;
46
    }
47
48
    /**
49
     * Set the name.
50
     *
51
     * @param string $name The name.
52
     * @return ValidationRuleInterface Returns this validation rule.
53
     */
54
    protected function setName($name) {
55
        $this->name = $name;
56
        return $this;
57
    }
58
}
59