| Total Complexity | 6 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | abstract class Repository |
||
| 19 | { |
||
| 20 | abstract protected function contract(): string; |
||
| 21 | |||
| 22 | 2 | public function delete(string $secretName): bool |
|
| 23 | { |
||
| 24 | 2 | return $this->query()->where('secret_name', $secretName)->delete() > 0; |
|
| 25 | } |
||
| 26 | |||
| 27 | 2 | public function createMultiple(array $structs): Collection |
|
| 28 | { |
||
| 29 | 2 | return $this->register($structs); |
|
| 30 | } |
||
| 31 | |||
| 32 | protected function register(array $authorizations): Collection |
||
| 33 | { |
||
| 34 | 6 | return $this->transform($authorizations)->map(function (array $attributes): Model { |
|
| 35 | 6 | return $this->query()->create($attributes); |
|
| 36 | 6 | }); |
|
| 37 | } |
||
| 38 | |||
| 39 | private function transform(array $authorization): Collection |
||
| 45 | ]; |
||
| 46 | 6 | }); |
|
| 47 | } |
||
| 48 | |||
| 49 | 6 | private function query(): Builder |
|
| 52 | } |
||
| 53 | |||
| 54 | 6 | private function model(): Model |
|
| 59 |