Completed
Push — middleware-wip ( a395c5...d52214 )
by Romain
03:54
created

PersistenceFetchingArguments   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 55
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A hashIsValid() 0 5 2
A formWasFound() 0 4 1
A getHash() 0 4 1
A getMetadata() 0 4 1
A getForm() 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\Middleware\Item\Persistence;
15
16
use Romm\Formz\Domain\Model\FormMetadata;
17
use Romm\Formz\Form\FormInterface;
18
use Romm\Formz\Middleware\Argument\Arguments;
19
20
class PersistenceFetchingArguments extends Arguments
21
{
22
    /**
23
     * @param string        $hash
24
     * @param FormMetadata  $metadata
25
     * @param FormInterface $form
26
     */
27
    public function __construct($hash, $metadata, $form)
28
    {
29
        $this->add('hash', $hash);
30
        $this->add('metadata', $metadata);
31
        $this->add('form', $form);
32
    }
33
34
    /**
35
     * @return bool
36
     */
37
    public function hashIsValid()
38
    {
39
        return null !== $this->getHash()
40
            && null !== $this->getMetadata();
41
    }
42
43
    /**
44
     * @return bool
45
     */
46
    public function formWasFound()
47
    {
48
        return null !== $this->getForm();
49
    }
50
51
    /**
52
     * @return string|null
53
     */
54
    public function getHash()
55
    {
56
        return $this->get('hash')->getValue();
57
    }
58
59
    /**
60
     * @return FormMetadata|null
61
     */
62
    public function getMetadata()
63
    {
64
        return $this->get('metadata')->getValue();
65
    }
66
67
    /**
68
     * @return FormInterface|null
69
     */
70
    public function getForm()
71
    {
72
        return $this->get('form')->getValue();
73
    }
74
}
75