Passed
Push — feature/micro-ref-email ( 897999 )
by Tristan
05:32
created

showSecondaryReferenceEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers\Api;
4
5
use App\Http\Controllers\Controller;
6
use App\Mail\MicroReferenceMail;
7
use App\Models\JobApplication;
8
use Illuminate\Support\Facades\Mail;
9
10
class MicroReferenceController extends Controller
11
{
12
13
    /**
14
     * Get email created to be sent to an application's Director reference.
15
     *
16
     * @param JobApplication $application The application the reference is for.
17
     *
18
     * @return \Illuminate\Http\Response
19
     */
20
    public function showDirectorEmail(JobApplication $application)
21
    {
22
        $mail = new MicroReferenceMail($application, true);
23
        return response()->json($mail->build()->toArray());
0 ignored issues
show
Bug introduced by
The function response was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        return /** @scrutinizer ignore-call */ response()->json($mail->build()->toArray());
Loading history...
24
    }
25
26
    public function sendDirectorEmail(JobApplication $application)
27
    {
28
        $mail = new MicroReferenceMail($application, true);
29
        Mail::send($mail->build());
30
        return response()->json($mail->build()->toArray());
0 ignored issues
show
Bug introduced by
The function response was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        return /** @scrutinizer ignore-call */ response()->json($mail->build()->toArray());
Loading history...
31
    }
32
33
    /**
34
     * Get email created to be sent to an application's Secondary reference.
35
     *
36
     * @param JobApplication $application The application the reference is for.
37
     *
38
     * @return \Illuminate\Http\Response
39
     */
40
    public function showSecondaryReferenceEmail(JobApplication $application)
41
    {
42
        $mail = new MicroReferenceMail($application, false);
43
        return response()->json($mail->build()->toArray());
0 ignored issues
show
Bug introduced by
The function response was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        return /** @scrutinizer ignore-call */ response()->json($mail->build()->toArray());
Loading history...
44
    }
45
46
    public function sendSecondaryReferenceEmail(JobApplication $application)
47
    {
48
        $mail = new MicroReferenceMail($application, false);
49
        Mail::send($mail->build());
50
        return response()->json($mail->build()->toArray());
0 ignored issues
show
Bug introduced by
The function response was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
        return /** @scrutinizer ignore-call */ response()->json($mail->build()->toArray());
Loading history...
51
    }
52
}
53