| Total Complexity | 6 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class BaseEarningProcessor |
||
| 6 | { |
||
| 7 | public $earning; |
||
| 8 | |||
| 9 | public function __construct($identifier) |
||
| 10 | { |
||
| 11 | if (is_string($identifier) || is_int($identifier)) { |
||
| 12 | $this->earning = config('open-payroll.models.earning')::query() |
||
| 13 | ->with('type') |
||
| 14 | ->findByHashSlugOrId($identifier); |
||
| 15 | } |
||
| 16 | |||
| 17 | if (is_object($identifier)) { |
||
| 18 | $this->earning($identifier); |
||
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | public static function make($identifier) |
||
| 23 | { |
||
| 24 | return new self($identifier); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function earning($earning) |
||
| 32 | } |
||
| 33 | |||
| 34 | abstract public function calculate(); |
||
| 35 | } |
||
| 36 |