Result::data()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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