Passed
Push — master ( 42367a...08368b )
by Sebastian
02:40
created

Request_Param_Validator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 5 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * File containing the {@link Request_Param_Validator} class.
4
 * 
5
 * @package Application Utils
6
 * @subpackage Request
7
 * @see Request_Param_Validator
8
 */
9
10
declare(strict_types=1);
11
12
namespace AppUtils;
13
14
/**
15
 * Base class skeleton for request parameter validation types.
16
 * 
17
 * @package Application Utils
18
 * @subpackage Request
19
 * @author Sebastian Mordziol <[email protected]>
20
 */
21
abstract class Request_Param_Validator implements Interface_Optionable
22
{
23
    use Traits_Optionable;
24
    
25
    /**
26
     * @var Request_Param
27
     */
28
    protected $param;
29
    
30
    protected $value;
31
    
32
    public function __construct(Request_Param $param)
33
    {
34
        $this->param = $param;
35
    }
36
    
37
    public function validate($value)
38
    {
39
        $this->value = $value;
40
        
41
        return $this->_validate();
42
    }
43
    
44
    abstract protected function _validate();
45
}
46