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

AbstractIndexMerger   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setConflictHandler() 0 6 1
A getConflictHandler() 0 9 2
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