GedComProgressSent::broadcastAs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace FamilyTree365\LaravelGedcom\Events;
4
5
use Illuminate\Broadcasting\Channel;
0 ignored issues
show
Bug introduced by
The type Illuminate\Broadcasting\Channel 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...
6
use Illuminate\Broadcasting\InteractsWithSockets;
0 ignored issues
show
Bug introduced by
The type Illuminate\Broadcasting\InteractsWithSockets 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...
7
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
0 ignored issues
show
Bug introduced by
The type Illuminate\Contracts\Broadcasting\ShouldBroadcast 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...
8
use Illuminate\Foundation\Events\Dispatchable;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\Events\Dispatchable 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 Illuminate\Queue\SerializesModels;
0 ignored issues
show
Bug introduced by
The type Illuminate\Queue\SerializesModels 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...
10
11
class GedComProgressSent implements ShouldBroadcast
12
{
13
    use Dispatchable;
14
    use InteractsWithSockets;
15
    use SerializesModels;
16
17
    public $slug;
18
    public $total;
19
    public $complete;
20
    public $channel;
21
22
    /**
23
     * Create a new event instance.
24
     *
25
     * @param $slug
26
     * @param $total
27
     * @param $complete
28
     */
29
    public function __construct(
30
        $slug,
31
        $total,
32
        $complete,
33
        $channel = ['name' => 'gedcom-progress', 'eventName' => 'newMessage']
34
    ) {
35
        $this->slug = $slug;
36
        $this->total = $total;
37
        $this->complete = $complete;
38
        $this->queue = 'low';
0 ignored issues
show
Bug Best Practice introduced by
The property queue does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
39
40
        $this->channel = $channel;
41
    }
42
43
    /**
44
     * Get the data to broadcast.
45
     *
46
     * @return array
47
     */
48
    public function broadcastWith()
49
    {
50
        return [
51
            'slug'     => $this->slug,
52
            'total'    => $this->total,
53
            'complete' => $this->complete,
54
        ];
55
    }
56
57
    /**
58
     * Get the channels the event should broadcast on.
59
     *
60
     * @return Channel|array
61
     */
62
    public function broadcastOn()
63
    {
64
        return new Channel($this->channel['name']);
65
    }
66
67
    public function broadcastAs()
68
    {
69
        return $this->channel['eventName'];
70
    }
71
}
72