ValidatorAwareTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setValidator() 0 5 1
A validate() 0 3 1
1
<?php
2
3
namespace Kontrolio;
4
5
/**
6
 * Trait to provide validation service.
7
 *
8
 * @package Kontrolio
9
 */
10
trait ValidatorAwareTrait
11
{
12
    /**
13
     * Validator instance.
14
     *
15
     * @var ValidatorInterface
16
     */
17
    protected $validator;
18
19
    /**
20
     * Sets validator.
21
     *
22
     * @param ValidatorInterface $validator
23
     *
24
     * @return $this
25
     */
26
    public function setValidator(ValidatorInterface $validator)
27
    {
28
        $this->validator = $validator;
29
30
        return $this;
31
    }
32
33
    /**
34
     * Performs validation.
35
     *
36
     * @return bool
37
     */
38
    public function validate()
39
    {
40
        return $this->validator->validate();
41
    }
42
}
43