Passed
Push — develop ( a18085...de8258 )
by Francisco
14:47
created

DeclinedExchangeNotification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 36
loc 36
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 10 10 1
A __construct() 3 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace App\Mail;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Mail\Mailable;
7
use App\Judite\Models\Exchange;
8
use Illuminate\Queue\SerializesModels;
9
10 View Code Duplication
class DeclinedExchangeNotification extends Mailable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    use Queueable, SerializesModels;
13
14
    /**
15
     * The declined exchange.
16
     *
17
     * @var string
18
     */
19
    private $exchange;
20
21
    /**
22
     * Create a new message instance.
23
     *
24
     * @param \App\Judite\Models\Exchange $exchange
25
     */
26
    public function __construct(Exchange $exchange)
27
    {
28
        $this->exchange = $exchange;
29
    }
30
31
    /**
32
     * Build the message.
33
     *
34
     * @return $this
35
     */
36
    public function build()
37
    {
38
        $course = $this->exchange->course();
39
        $fromStudent = $this->exchange->fromStudent();
40
        $toStudent = $this->exchange->toStudent();
41
        $fromShift = $this->exchange->fromShift();
42
        $toShift = $this->exchange->toShift();
43
44
        return $this->markdown('emails.exchanges.declined',
45
            compact('course', 'fromStudent', 'toStudent', 'fromShift', 'toShift'));
46
    }
47
}
48