| Total Complexity | 8 | 
| Total Lines | 76 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | abstract class Mapping  | 
            ||
| 10 | { | 
            ||
| 11 | use IsModelSearchable;  | 
            ||
| 12 | |||
| 13 | /** @var Model|Searchable */  | 
            ||
| 14 | protected $model;  | 
            ||
| 15 | |||
| 16 | /** @var string */  | 
            ||
| 17 | protected $index;  | 
            ||
| 18 | |||
| 19 | /** @var string */  | 
            ||
| 20 | protected $type;  | 
            ||
| 21 | |||
| 22 | /**  | 
            ||
| 23 | * Mapping constructor.  | 
            ||
| 24 | *  | 
            ||
| 25 | * @throws \InvalidArgumentException  | 
            ||
| 26 | */  | 
            ||
| 27 | 14 | public function __construct()  | 
            |
| 28 |     { | 
            ||
| 29 | 14 | $modelClass = $this->model();  | 
            |
| 30 | 14 | $this->model = new $modelClass();  | 
            |
| 31 | |||
| 32 | 14 | $this->isModelSearchable($this->model);  | 
            |
| 33 | 13 | }  | 
            |
| 34 | |||
| 35 | /**  | 
            ||
| 36 | * Get mapped eloquent model class  | 
            ||
| 37 | *  | 
            ||
| 38 | * @return string  | 
            ||
| 39 | */  | 
            ||
| 40 | abstract public function model() : string;  | 
            ||
| 41 | |||
| 42 | /**  | 
            ||
| 43 | * Map  | 
            ||
| 44 | */  | 
            ||
| 45 | abstract public function map();  | 
            ||
| 46 | |||
| 47 | /**  | 
            ||
| 48 | * @param string $index  | 
            ||
| 49 | */  | 
            ||
| 50 | 3 | public function setDocumentIndex(string $index): void  | 
            |
| 51 |     { | 
            ||
| 52 | 3 | $this->index = $index;  | 
            |
| 53 | 3 | }  | 
            |
| 54 | |||
| 55 | /**  | 
            ||
| 56 | * @param string $type  | 
            ||
| 57 | */  | 
            ||
| 58 | 3 | public function setDocumentType(string $type): void  | 
            |
| 59 |     { | 
            ||
| 60 | 3 | $this->type = $type;  | 
            |
| 61 | 3 | }  | 
            |
| 62 | |||
| 63 | /**  | 
            ||
| 64 | * Get es index  | 
            ||
| 65 | *  | 
            ||
| 66 | * @return string  | 
            ||
| 67 | */  | 
            ||
| 68 | 13 | public function getDocumentIndex() : string  | 
            |
| 75 | }  | 
            ||
| 76 | |||
| 77 | /**  | 
            ||
| 78 | * Get es type  | 
            ||
| 79 | *  | 
            ||
| 80 | * @return string  | 
            ||
| 81 | */  | 
            ||
| 82 | 12 | public function getDocumentType() : string  | 
            |
| 85 | }  | 
            ||
| 86 | }  | 
            ||
| 87 |