Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RemoteConfigResource | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Resources\v2; |
| 4 | |
| 5 | use Illuminate\Http\Request; |
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
| 7 | |
| 8 | /** |
| 9 | * Resource for transforming RemoteConfig models for admin API responses. |
| 10 | * |
| 11 | * @property string $version The config version identifier |
| 12 | * @property array|null $linkedin_selectors LinkedIn DOM selectors |
| 13 | * @property array|null $outlook_domains Outlook domain detection config |
| 14 | * @property array|null $timing Timing constants |
| 15 | * @property array|null $feature_flags Feature flags |
| 16 | * @property array|null $features Extension feature toggles |
| 17 | * @property array|null $playlists Playlist config |
| 18 | * @property array|null $blacklist_config Input blacklist rules |
| 19 | * @property array|null $ui_visibility UI element visibility toggles |
| 20 | * @property array|null $field_injection Field injection config per domain |
| 21 | * @property array|null $force_plain_text Force plain-text paste config per domain |
| 22 | * @property array|null $display_strategy_grammar Display strategy rules for Grammar feature per domain |
| 23 | * @property array|null $display_strategy_magic_wand Display strategy rules for Magic Wand feature per domain |
| 24 | * @property array|null $display_strategy_paragraph Display strategy rules for Paragraph feature per domain |
| 25 | * @property string|null $updated_by Who last updated this config |
| 26 | * @property \Carbon\Carbon|null $updated_at |
| 27 | */ |
| 28 | class RemoteConfigResource extends JsonResource |
| 29 | { |
| 30 | /** |
| 31 | * Transform the resource into an array. |
| 32 | * |
| 33 | * @return array<string, mixed> |
| 34 | */ |
| 35 | public function toArray(Request $request): array |
| 36 | { |
| 37 | return [ |
| 38 | 'version' => $this->version, |
| 39 | 'linkedin_selectors' => $this->linkedin_selectors, |
| 40 | 'outlook_domains' => $this->outlook_domains, |
| 41 | 'timing' => $this->timing, |
| 42 | 'feature_flags' => $this->feature_flags, |
| 43 | 'features' => $this->features, |
| 44 | 'playlists' => $this->playlists, |
| 45 | 'blacklist_config' => $this->blacklist_config, |
| 46 | 'ui_visibility' => $this->ui_visibility, |
| 47 | 'field_injection' => $this->field_injection, |
| 48 | 'force_plain_text' => $this->force_plain_text, |
| 49 | 'display_strategy_grammar' => $this->display_strategy_grammar, |
| 50 | 'display_strategy_magic_wand' => $this->display_strategy_magic_wand, |
| 51 | 'display_strategy_paragraph' => $this->display_strategy_paragraph, |
| 52 | 'updated_by' => $this->updated_by, |
| 53 | 'updated_at' => $this->updated_at?->timestamp, |
| 54 | ]; |
| 55 | } |
| 56 | } |