Passed
Push — master ( 8692a8...cbe8ef )
by Nasrul Hazim
02:21
created

BaseDeductionProcessor::deduction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CleaniqueCoders\OpenPayroll\Processors\Deduction;
4
5
class BaseDeductionProcessor
6
{
7
    public $deduction;
8
9
    public function __construct($identifier)
10
    {
11
        if (is_string($identifier) || is_int($identifier)) {
12
            $this->deduction = config('open-payroll.models.deduction')::query()
13
                ->with('type')
14
                ->findByHashSlugOrId($identifier);
15
        }
16
17
        if (is_object($identifier)) {
18
            $this->deduction($identifier);
19
        }
20
    }
21
22
    public static function make($identifier)
23
    {
24
        return new self($identifier);
25
    }
26
27
    public function deduction($deduction)
28
    {
29
        $this->deduction = $deduction;
30
31
        return $this;
32
    }
33
34
    abstract public function calculate();
35
}
36