AbstractHandler::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace MisterIcy\ExcelWriter\Handlers;
5
6
use MisterIcy\ExcelWriter\Generator\GeneratorInterface;
7
8
/**
9
 * Class AbstractHandler
10
 * @package MisterIcy\ExcelWriter\Handlers
11
 */
12
abstract class AbstractHandler implements HandlerInterface
13
{
14
    /**
15
     * @var HandlerInterface
16
     */
17
    private $next;
18
19
    /**
20
     * @param HandlerInterface $handler
21
     * @return HandlerInterface
22
     */
23
    public function setNext(HandlerInterface $handler): HandlerInterface
24
    {
25
        $this->next = $handler;
26
        return $this->next;
27
    }
28
29
    /**
30
     * @param GeneratorInterface $generator
31
     * @return mixed|null
32
     */
33
    public function handle(GeneratorInterface $generator)
34
    {
35
        if (!is_null($this->next)) {
36
            return $this->next->handle($generator);
37
        }
38
        return null;
39
    }
40
}
41