Completed
Push — master ( 77f170...166d1e )
by Arne
03:02
created

AbstractIndexMerger::setConflictHandler()   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
namespace Archivr\IndexMerger;
4
5
use Archivr\ConflictHandler\ConflictHandlerInterface;
6
use Archivr\ConflictHandler\PanickingConflictHandler;
7
8
abstract class AbstractIndexMerger implements IndexMergerInterface
9
{
10
    /**
11
     * @var ConflictHandlerInterface
12
     */
13
    protected $conflictHandler;
14
15
    public function setConflictHandler(ConflictHandlerInterface $conflictHandler = null): IndexMergerInterface
16
    {
17
        $this->conflictHandler = $conflictHandler;
18
19
        return $this;
20
    }
21
22
    public function getConflictHandler(): ConflictHandlerInterface
23
    {
24
        if ($this->conflictHandler === null)
25
        {
26
            $this->setConflictHandler(new PanickingConflictHandler());
27
        }
28
29
        return $this->conflictHandler;
30
    }
31
}
32