| Total Complexity | 9 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class PayslipProcessor implements CalculateContract |
||
| 8 | { |
||
| 9 | public $payslip; |
||
| 10 | |||
| 11 | public function __construct($identifier = null) |
||
| 12 | { |
||
| 13 | if (! is_null($identifier)) { |
||
| 14 | if (is_string($identifier) || is_int($identifier)) { |
||
| 15 | $this->payslip = config('open-payroll.models.payslip')::query() |
||
| 16 | ->with('earnings', 'deductions', 'payroll', 'employee', 'employee.salary') |
||
| 17 | ->whereId($identifier) |
||
| 18 | ->orWhere('hashslug', $identifier) |
||
| 19 | ->firstOrFail(); |
||
| 20 | } |
||
| 21 | |||
| 22 | if (is_object($identifier)) { |
||
| 23 | $this->payslip($identifier); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | public static function make($identifier = null) |
||
| 29 | { |
||
| 30 | return new self($identifier); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function payslip($payslip) |
||
| 34 | { |
||
| 35 | $this->payslip = $payslip; |
||
| 36 | |||
| 37 | return $this; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function calculate() |
||
| 57 | } |
||
| 58 | } |
||
| 59 |