Conditions | 5 |
Paths | 16 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | 118 | public function details(): Details |
|
15 | { |
||
16 | // Generic model details |
||
17 | // might be able to remove this as id isnt general info |
||
18 | 118 | $id = Str::slug($this->registration->key().'-'.$this->model->id); |
|
19 | 118 | $key = $this->registration->key(); |
|
20 | 118 | $labelSingular = property_exists($this->model, 'labelSingular') ? $this->model->labelSingular : Str::singular($key); |
|
21 | 118 | $labelPlural = property_exists($this->model, 'labelPlural') ? $this->model->labelPlural : Str::plural($key); |
|
22 | 118 | $internal_label = contract($this->model, ProvidesFlatReference::class) ? $this->model->flatReferenceLabel() : $key; |
|
23 | |||
24 | // Manager index and header info |
||
25 | 118 | $title = $this->model->title ?? ($this->model->id ? $labelSingular . ' ' . $this->model->id : $labelSingular); |
|
26 | |||
27 | 118 | return new Details( |
|
28 | 118 | $id, |
|
29 | 118 | $key, |
|
30 | 118 | $labelSingular.'', |
|
31 | 118 | $labelPlural.'', |
|
32 | 118 | $internal_label, |
|
33 | 118 | $title.'' |
|
34 | ); |
||
37 |