Result   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 59
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A errors() 0 3 1
A data() 0 3 1
A messages() 0 3 1
1
<?php
2
3
/**
4
 * Linna Filter
5
 *
6
 * @author Sebastian Rapetti <[email protected]>
7
 * @copyright (c) 2018, Sebastian Rapetti
8
 * @license http://opensource.org/licenses/MIT MIT License
9
 */
10
declare(strict_types=1);
11
12
namespace Linna\Filter;
13
14
abstract class Result
15
{
16
    /**
17
     * @var array Sanitized data.
18
     */
19
    private $data = [];
20
21
    /**
22
     * @var array Error messages.
23
     */
24
    private $message = [];
25
26
    /**
27
    * @var int Occurred errors.
28
    */
29
    private $error = 0;
30
31
    /**
32
     * Class Constructor.
33
     *
34
     * @param array $data
35
     * @param array $message
36
     * @param int   $error
37
     */
38 81
    public function __construct(array $data, array $message, int $error)
39
    {
40 81
        $this->data = $data;
41 81
        $this->message = $message;
42 81
        $this->error = $error;
43 81
    }
44
45
    /**
46
     * Return sanitized data.
47
     *
48
     * @return array
49
     */
50 1
    public function data(): array
51
    {
52 1
        return $this->data;
53
    }
54
55
    /**
56
     * Return error messages.
57
     *
58
     * @return array
59
     */
60 1
    public function messages(): array
61
    {
62 1
        return $this->message;
63
    }
64
65
    /**
66
     * Return the number of occurred errors.
67
     *
68
     * @return int
69
     */
70 27
    public function errors(): int
71
    {
72 27
        return $this->error;
73
    }
74
}
75