Passed
Push — master ( bba981...a1f61b )
by Stephen
02:25
created

TrackSpamAction::__construct()   A

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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Sfneal\Honeypot\Actions;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Http\Request;
8
use Sfneal\Actions\AbstractAction;
0 ignored issues
show
Bug introduced by
The type Sfneal\Actions\AbstractAction 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...
9
use Sfneal\Honeypot\Models\TrackSpam;
10
11
// TODO: create package TrackSpam
12
class TrackSpamAction extends AbstractAction
13
{
14
    /**
15
     * @var string Unique TrackTraffic request_token
16
     */
17
    private $request_token;
18
19
    /**
20
     * TrackSpamAction constructor.
21
     *
22
     * @param Request $request
23
     */
24
    public function __construct(Request $request)
25
    {
26
        $this->request_token = $request->attributes->get('track_traffic_token');
27
    }
28
29
    /**
30
     * Execute the Action.
31
     *
32
     * @return Builder|Model|mixed
33
     */
34
    public function execute()
35
    {
36
        return TrackSpam::query()->create([
37
            'request_token' => $this->request_token,
38
        ]);
39
    }
40
}
41