Completed
Push — master ( cc421c...3c5a59 )
by Carlos
07:01
created

RelationToggled   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the overtrue/laravel-follow
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Overtrue\LaravelFollow\Events;
13
use Illuminate\Database\Eloquent\Model;
14
15
/**
16
 * Class RelationToggled.
17
 *
18
 * @author overtrue <[email protected]>
19
 */
20
class RelationToggled extends Event
21
{
22
    public $results = [];
23
    public $attached = [];
24
    public $detached = [];
25
26
    /**
27
     * RelationToggled constructor.
28
     *
29
     * @param \Illuminate\Database\Eloquent\Model $causer
30
     * @param                                     $relation
31
     * @param                                     $targets
32
     * @param                                     $class
33
     * @param array                               $results
34
     */
35
    public function __construct(\Illuminate\Database\Eloquent\Model $causer, $relation, $targets, $class, array $results = [])
36
    {
37
        parent::__construct($causer, $relation, $targets, $class);
38
39
        $this->results = $results;
40
        $this->attached = $results['attached'] ?? [];
41
        $this->detached = $results['detached'] ?? [];
42
    }
43
}
44