Completed
Push — develop ( 23fb07...aaf888 )
by Fabian
13s queued 11s
created

HandlerManager::forwardRedirect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cakasim\Payone\Sdk\Redirect\Handler;
6
7
use Cakasim\Payone\Sdk\Redirect\Context\ContextInterface;
8
9
/**
10
 * @author Fabian Böttcher <[email protected]>
11
 * @since 1.0.0
12
 */
13
class HandlerManager implements HandlerManagerInterface
14
{
15
    /**
16
     * @var HandlerInterface[] The redirect handlers.
17
     */
18
    protected $handlers = [];
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public function registerHandler(HandlerInterface $handler): void
24
    {
25
        $this->handlers[] = $handler;
26
    }
27
28
    /**
29
     * @inheritDoc
30
     */
31
    public function forwardRedirect(ContextInterface $context): void
32
    {
33
        foreach ($this->handlers as $handler) {
34
            $handler->handleRedirect($context);
35
        }
36
    }
37
}
38