CanMagicallyLogin::sendMagicLinkNotification()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Soved\Laravel\Magic\Auth\Traits;
4
5
use Soved\Laravel\Magic\Auth\Notifications\MagicLink as MagicLinkNotification;
6
7
trait CanMagicallyLogin
8
{
9
    /**
10
     * Get the e-mail address where magic links are sent.
11
     *
12
     * @return string
13
     */
14
    public function getEmailForMagicLink()
15
    {
16
        return $this->email;
17
    }
18
19
    /**
20
     * Send the magic link notification.
21
     *
22
     * @param  string  $link
23
     * @return void
24
     */
25
    public function sendMagicLinkNotification(string $link)
26
    {
27
        $this->notify(new MagicLinkNotification($link));
0 ignored issues
show
Bug introduced by
It seems like notify() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

27
        $this->/** @scrutinizer ignore-call */ 
28
               notify(new MagicLinkNotification($link));
Loading history...
28
    }
29
30
    /**
31
     * Determine if the user was authenticated via a magic link.
32
     *
33
     * @return bool
34
     */
35
    public function viaMagicLink()
36
    {
37
        return session('viaMagicLink', false);
0 ignored issues
show
Bug introduced by
The function session 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

37
        return /** @scrutinizer ignore-call */ session('viaMagicLink', false);
Loading history...
38
    }
39
}
40