InteractsWithAuthentication   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 56
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A login() 0 8 1
A loginAs() 0 8 1
A logout() 0 8 1
A assertAuthenticated() 0 6 1
A assertGuest() 0 6 1
A assertAuthenticatedAs() 0 6 1
1
<?php
2
3
namespace BeyondCode\DuskDashboard\Dusk\Concerns;
4
5
trait InteractsWithAuthentication
6
{
7
    /** {@inheritdoc} */
8
    public function login()
9
    {
10
        $browser = parent::login();
11
12
        $this->actionCollector->collect(__FUNCTION__, func_get_args(), $this);
0 ignored issues
show
Bug introduced by
The property actionCollector does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
14
        return $browser;
15
    }
16
17
    /** {@inheritdoc} */
18
    public function loginAs($userId, $guard = null)
19
    {
20
        $browser = parent::loginAs($userId, $guard);
21
22
        $this->actionCollector->collect(__FUNCTION__, func_get_args(), $this);
23
24
        return $browser;
25
    }
26
27
    /** {@inheritdoc} */
28
    public function logout($guard = null)
29
    {
30
        $browser = parent::logout($guard);
31
32
        $this->actionCollector->collect(__FUNCTION__, func_get_args(), $this);
33
34
        return $browser;
35
    }
36
37
    /** {@inheritdoc} */
38
    public function assertAuthenticated($guard = null)
39
    {
40
        $this->actionCollector->collect(__FUNCTION__, func_get_args(), $this);
41
42
        return parent::assertAuthenticated($guard);
43
    }
44
45
    /** {@inheritdoc} */
46
    public function assertGuest($guard = null)
47
    {
48
        $this->actionCollector->collect(__FUNCTION__, func_get_args(), $this);
49
50
        return parent::assertGuest($guard);
51
    }
52
53
    /** {@inheritdoc} */
54
    public function assertAuthenticatedAs($user, $guard = null)
55
    {
56
        $this->actionCollector->collect(__FUNCTION__, func_get_args(), $this);
57
58
        return parent::assertAuthenticatedAs($user, $guard);
59
    }
60
}
61