Completed
Push — middleware-wip ( ab9573...668c38 )
by Romain
10:14
created

FormValidatorDataObject   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 65
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getResult() 0 4 1
A getFieldValidationCallbacks() 0 4 1
A addFieldValidationCallback() 0 4 1
A getCurrentStep() 0 4 1
A setCurrentStep() 0 4 1
1
<?php
2
/*
3
 * 2017 Romain CANON <[email protected]>
4
 *
5
 * This file is part of the TYPO3 FormZ project.
6
 * It is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License, either
8
 * version 3 of the License, or any later version.
9
 *
10
 * For the full copyright and license information, see:
11
 * http://www.gnu.org/licenses/gpl-3.0.html
12
 */
13
14
namespace Romm\Formz\Validation\Validator\Form\DataObject;
15
16
use Romm\Formz\Configuration\Form\Step\Step\StepItem;
17
use Romm\Formz\Error\FormResult;
18
19
class FormValidatorDataObject
20
{
21
    /**
22
     * @var FormResult
23
     */
24
    protected $result;
25
26
    /**
27
     * @var callable[]
28
     */
29
    protected $fieldValidationCallback;
30
31
    /**
32
     * @var StepItem
33
     */
34
    protected $currentStep;
35
36
    /**
37
     * @param FormResult $result
38
     */
39
    public function __construct(FormResult $result)
40
    {
41
        $this->result = $result;
42
    }
43
44
    /**
45
     * @return FormResult
46
     */
47
    public function getResult()
48
    {
49
        return $this->result;
50
    }
51
52
    /**
53
     * @return callable[]
54
     */
55
    public function getFieldValidationCallbacks()
56
    {
57
        return $this->fieldValidationCallback;
58
    }
59
60
    /**
61
     * @param callable $fieldValidationCallback
62
     */
63
    public function addFieldValidationCallback(callable $fieldValidationCallback)
64
    {
65
        $this->fieldValidationCallback[] = $fieldValidationCallback;
66
    }
67
68
    /**
69
     * @return StepItem
70
     */
71
    public function getCurrentStep()
72
    {
73
        return $this->currentStep;
74
    }
75
76
    /**
77
     * @param StepItem $currentStep
78
     */
79
    public function setCurrentStep(StepItem $currentStep)
80
    {
81
        $this->currentStep = $currentStep;
82
    }
83
}
84