Test Setup Failed
Push — master ( 93675a...ba3342 )
by Mohamed
14:07 queued 12s
created

IncorrectTemplate   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 3
A build() 0 7 1
1
<?php
2
3
namespace App\Mail;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Mail\Mailable;
7
use Illuminate\Queue\SerializesModels;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
10
class IncorrectTemplate extends Mailable
11
{
12
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\IncorrectTemplate: $id, $relations, $class, $keyBy
Loading history...
13
14
     /**
15
     * Create a new message instance.
16
     *
17
     * @return void
18
     */
19
    public function __construct($file)
20
    {
21
22
        $institution = Institution_class::find($file['institution_class_id']);
0 ignored issues
show
Bug introduced by
The type App\Mail\Institution_class was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
24
25
        $this->user = User::find($file['security_user_id']);
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
Bug introduced by
The type App\Mail\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
        $this->subject = 'SIS Bulk Upload: IncorrectTemplate'.$institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s');
27
        $this->from_address = env('MAIL_FROM_ADDRESS');
0 ignored issues
show
Bug Best Practice introduced by
The property from_address does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
28
        $this->from_name = 'SIS Bulk Uploader';
0 ignored issues
show
Bug Best Practice introduced by
The property from_name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
29
        $this->with = [
0 ignored issues
show
Bug Best Practice introduced by
The property with does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
30
            'name' => $this->user->first_name,
31
            'link' =>  env('APP_ENV','local') == 'stage' | 'local' | 'prod' ?  env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename']
0 ignored issues
show
Bug introduced by
Are you sure you want to use the bitwise | or did you mean ||?
Loading history...
32
        ];
33
        $this->viewData = [
34
            'name'=>$this->user->first_name, "body" => "The Template you used for upload having some issues, please reconfirm and re-upload with correct template",
35
            'link' =>  env('APP_ENV','local') == 'stage' | 'local' | 'prod' ?  env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename']
0 ignored issues
show
Bug introduced by
Are you sure you want to use the bitwise | or did you mean ||?
Loading history...
36
        ];
37
    }
38
39
    /**
40
     * Build the message.
41
     *
42
     * @return $this
43
     */
44
    public function build()
45
    {
46
        return $this->view('emails.mail')
47
            ->from($this->from_address,$this->from_name)
48
            ->to($this->user->email)
49
            ->subject($this->subject)
50
            ->with($this->with);
51
    }
52
}
53