1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ElfSundae\BearyChat\Laravel\Jobs; |
4
|
|
|
|
5
|
|
|
use ElfSundae\BearyChat\Client; |
6
|
|
|
use ElfSundae\BearyChat\Message; |
7
|
|
|
use Illuminate\Bus\Queueable; |
|
|
|
|
8
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue; |
9
|
|
|
use Illuminate\Foundation\Bus\Dispatchable; |
|
|
|
|
10
|
|
|
use Illuminate\Queue\InteractsWithQueue; |
|
|
|
|
11
|
|
|
use Illuminate\Queue\SerializesModels; |
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Queueable BearyChat Job for Laravel 5.4 or later. |
15
|
|
|
* |
16
|
|
|
* @see https://laravel.com/docs/queues |
17
|
|
|
*/ |
18
|
|
|
class SendBearyChat implements ShouldQueue |
19
|
|
|
{ |
20
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The BearyChat client. |
24
|
|
|
* |
25
|
|
|
* @var \ElfSundae\BearyChat\Client |
26
|
|
|
*/ |
27
|
|
|
protected $client; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The Message instance to be sent. |
31
|
|
|
* |
32
|
|
|
* @var \ElfSundae\BearyChat\Message |
33
|
|
|
*/ |
34
|
|
|
protected $message; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Create a new job instance. |
38
|
|
|
* |
39
|
|
|
* @param mixed $message |
40
|
|
|
*/ |
41
|
|
|
public function __construct($message = null) |
42
|
|
|
{ |
43
|
|
|
if ($message instanceof Message) { |
44
|
|
|
$this->message = $message; |
45
|
|
|
} elseif (! is_null($message)) { |
46
|
|
|
call_user_func_array([$this, 'content'], func_get_args()); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Set the BearyChat client. |
52
|
|
|
* |
53
|
|
|
* @param \ElfSundae\BearyChat\Client|string $client |
54
|
|
|
* @return $this |
55
|
|
|
*/ |
56
|
|
|
public function client($client) |
57
|
|
|
{ |
58
|
|
|
$this->client = $client instanceof Client ? $client : bearychat($client); |
59
|
|
|
|
60
|
|
|
if ($this->message) { |
61
|
|
|
$this->message->setClient($this->client); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Execute the job. |
69
|
|
|
* |
70
|
|
|
* @return void |
71
|
|
|
*/ |
72
|
|
|
public function handle() |
73
|
|
|
{ |
74
|
|
|
if (! $this->message->getClient()) { |
75
|
|
|
$this->message->setClient($this->client ?: bearychat()); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
$this->message->send(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Any unhandled methods will be sent to the Message instance. |
83
|
|
|
* |
84
|
|
|
* @param string $method |
85
|
|
|
* @param array $parameters |
86
|
|
|
* @return $this |
87
|
|
|
*/ |
88
|
|
|
public function __call($method, $parameters) |
89
|
|
|
{ |
90
|
|
|
if (! $this->message) { |
91
|
|
|
$this->message = new Message($this->client ?: bearychat()); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
call_user_func_array([$this->message, $method], $parameters); |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths