Completed
Pull Request — master (#21)
by Shawn
02:20
created

DutyToday::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace SET\Mail;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Queue\SerializesModels;
9
use SET\Duty;
10
use SET\User;
11
12
class DutyToday extends Mailable implements ShouldQueue
13
{
14
    use Queueable, SerializesModels;
15
16
    public $duty;
17
    public $user;
18
19
    /**
20
     * DutyToday constructor.
21
     *
22
     * @param Duty $duty
23
     * @param User $user
24
     */
25
    public function __construct(Duty $duty, User $user)
26
    {
27
        $this->duty = $duty;
28
        $this->user = $user;
29
    }
30
31
    /**
32
     * Build the message.
33
     *
34
     * @return $this
35
     */
36
    public function build()
37
    {
38
        return $this->view('emails.duty_today')
39
            ->subject('Reminder: You have '.$this->duty->name.' security check today.');
1 ignored issue
show
Documentation introduced by
The property name does not exist on object<SET\Duty>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
40
    }
41
}
42