summaryrefslogtreecommitdiff
path: root/includes/model/ValidationResult.php
blob: 7f88b43239f53674dfc52eb7f91acdfe05a5d635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

namespace Engelsystem;

/**
 * BO that represents the result of an entity attribute validation.
 * It contains the validated value and a bool for validation success.
 */
class ValidationResult
{
    /** @var bool */
    private $valid;

    /** @var mixed */
    private $value;

    /**
     * @param boolean $valid Is the value valid?
     * @param mixed   $value The validated value
     */
    public function __construct($valid, $value)
    {
        $this->valid = $valid;
        $this->value = $value;
    }

    /**
     * Is the value valid?
     *
     * @return bool
     */
    public function isValid()
    {
        return $this->valid;
    }

    /**
     * The parsed/validated value.
     *
     * @return mixed
     */
    public function getValue()
    {
        return $this->value;
    }
}