ExampleServiceI   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A destroy() 0 3 1
A index() 0 3 1
A __construct() 0 3 1
A show() 0 3 1
A update() 0 3 1
A store() 0 3 1
1
<?php
2
3
namespace Modules\Example\Services;
4
5
use Modules\Core\Supports\Response;
6
use Modules\Example\Repositories\ExampleRepository;
7
8
class ExampleServiceI implements ExampleService
9
{
10
    /**
11
     * @var \Modules\Example\Repositories\ExampleRepository
12
     */
13
    private $exampleRepository;
14
15
    public function __construct(ExampleRepository $dataRepository)
16
    {
17
        $this->exampleRepository = $dataRepository;
18
    }
19
20
    public function index(): Response
21
    {
22
        return Response::handleOk($this->exampleRepository->all());
23
    }
24
25
    public function store(array $attributes): Response
26
    {
27
        return Response::handleCreated($this->exampleRepository->create($attributes));
28
    }
29
30
    public function show(int $id): Response
31
    {
32
        return Response::handleOk($this->exampleRepository->find($id));
33
    }
34
35
    public function update(int $id, array $attributes): Response
36
    {
37
        return Response::handleResetContent($this->exampleRepository->update($attributes, $id));
38
    }
39
40
    public function destroy(int $id): Response
41
    {
42
        return Response::handleNoContent($this->exampleRepository->delete($id));
43
    }
44
}
45