Completed
Pull Request — master (#47)
by Phecho
04:02
created

NoteController::getNotes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Gitamin\Http\Controllers\Api;
4
5
use Gitamin\Commands\Note\AddNoteCommand;
6
use Gitamin\Models\Note;
7
use GrahamCampbell\Binput\Facades\Binput;
8
use Illuminate\Contracts\Auth\Guard;
9
use Illuminate\Database\QueryException;
10
use Illuminate\Foundation\Bus\DispatchesJobs;
11
use Illuminate\Http\Request;
12
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
13
14
class NoteController extends AbstractApiController
15
{
16
    use DispatchesJobs;
17
    
18
19
    public function getNotes()
20
    {
21
22
    }
23
24
    public function getNote(Note $note)
0 ignored issues
show
Unused Code introduced by
The parameter $note is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
27
    }
28
    /**
29
     * Create a new note.
30
     *
31
     * @param \Illuminate\Contracts\Auth\Guard $auth
32
     *
33
     * @return \Illuminate\Http\JsonResponse
34
     */
35
    public function postNotes(Guard $auth)
0 ignored issues
show
Unused Code introduced by
The parameter $auth is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
    {
37
        try {
38
            $note = $this->dispatch(new AddNoteCommand(
39
                Binput::get('description'),
40
                Binput::get('noteable_type'),
41
                Binput::get('noteable_id'),
42
                Binput::get('author_id'),
43
                Binput::get('project_id')
44
            ));
45
        } catch (QueryException $e) {
46
            throw new BadRequestHttpException();
47
        }
48
49
        return $this->item($note);
50
    }
51
}
52