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

HandlerManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forwardRedirect() 0 4 2
A registerHandler() 0 3 1
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