Completed
Push — feature/middleware ( aef20d...bf156f )
by Romain
02:16
created

OnBeginMiddleware::after()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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\Element;
15
16
use Romm\Formz\Middleware\Argument\Arguments;
17
use Romm\Formz\Domain\Middleware\Begin\BeginSignal;
18
use Romm\Formz\Middleware\Signal\After;
19
20
/**
21
 * Middleware abstraction that can be extended by custom middleware.
22
 *
23
 * Note that a middleware extending this class will be called at the beginning
24
 * of the middleware processing.
25
 *
26
 * If you need the middleware to be called later, you can:
27
 * - @see \Romm\Formz\Middleware\Element\DefaultMiddleware (called at the end)
28
 * - @see \Romm\Formz\Middleware\Element\AbstractMiddleware
29
 */
30
abstract class OnBeginMiddleware extends AbstractMiddleware implements After, BeginSignal
31
{
32
    /**
33
     * @var Arguments
34
     */
35
    private $arguments;
36
37
    /**
38
     * @return void
39
     */
40
    abstract protected function process();
41
42
    /**
43
     * We override this function to manually call the `process` function.
44
     *
45
     * @param Arguments $arguments
46
     */
47
    final public function after(Arguments $arguments)
48
    {
49
        $this->arguments = $arguments;
50
51
        $this->process();
52
    }
53
54
    /**
55
     * @return Arguments
56
     */
57
    final protected function getArguments()
58
    {
59
        return $this->arguments;
60
    }
61
}
62