Issues (28)

src/Queries/Base/TrackingQuery.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Sfneal\Tracking\Queries\Base;
4
5
use Sfneal\Queries\Query;
6
use Sfneal\Queries\Traits\HasRelationships;
7
use Sfneal\Tracking\Requests\TrackRequest;
8
9
abstract class TrackingQuery extends Query
10
{
11
    use HasRelationships;
12
13
    /**
14
     * @var TrackRequest|null
15
     */
16
    protected $request;
17
18
    /**
19
     * @var array
20
     */
21
    protected $parameters;
22
23
    /**
24
     * TrackActionQuery constructor.
25
     *
26
     * @param  TrackRequest|null  $request
27
     * @param  array|null  $parameters
28
     */
29
    public function __construct(TrackRequest $request = null, array $parameters = null)
30
    {
31
        $this->request = $request;
32
        $this->parameters = $parameters ?? [];
33
34
        // Merge validated request inputs with parameters
35
        if ($validated = $this->request->validated()) {
0 ignored issues
show
The method validated() does not exist on null. ( Ignorable by Annotation )

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

35
        if ($validated = $this->request->/** @scrutinizer ignore-call */ validated()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
            $this->parameters = array_merge($this->parameters, $validated);
37
        }
38
    }
39
}
40