Passed
Push — master ( 786e6d...5b3c5d )
by Carlos
03:04
created

Event::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
1
<?php
2
3
4
namespace Overtrue\LaravelFollow\Events;
5
6
use Illuminate\Broadcasting\Channel;
7
use Illuminate\Database\Eloquent\Model;
8
use Illuminate\Queue\SerializesModels;
9
use Illuminate\Broadcasting\PrivateChannel;
10
use Illuminate\Broadcasting\PresenceChannel;
11
use Illuminate\Foundation\Events\Dispatchable;
12
use Illuminate\Broadcasting\InteractsWithSockets;
13
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
14
use Overtrue\LaravelFollow\Follow;
15
16
/**
17
 * Class Event
18
 *
19
 * @author overtrue <[email protected]>
20
 */
21
class Event
22
{
23
    use Dispatchable, InteractsWithSockets, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Overtrue\LaravelFollow\Events\Event: $id, $connection, $relations
Loading history...
24
25
    public $causer;
26
    public $relation;
27
    public $targets;
28
    public $class;
29
30
    /**
31
     * Event constructor.
32
     *
33
     * @param \Illuminate\Database\Eloquent\Model   $causer
34
     * @param \Overtrue\LaravelFollow\Events\string $relation
0 ignored issues
show
Bug introduced by
The type Overtrue\LaravelFollow\Events\string 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...
35
     * @param int|array                             $targets
36
     * @param \Overtrue\LaravelFollow\Events\string $class
37
     */
38
    public function __construct(Model $causer, string $relation, $targets, string $class)
39
    {
40
        $this->causer = $causer;
41
        $this->relation = $relation;
42
        $this->targets = $targets;
43
        $this->class = $class;
44
    }
45
46
    public function getRelationType()
47
    {
48
        return Follow::RELATION_TYPES[$this->relation];
49
    }
50
51
    public function getTargetsCollection()
52
    {
53
        return \forward_static_call([$this->class, 'find'], (array) $this->targets);
54
    }
55
}