1 | <?php |
||
21 | class CaptainHookServiceProvider extends ServiceProvider |
||
22 | { |
||
23 | use DispatchesJobs; |
||
24 | |||
25 | /** |
||
26 | * The registered event listeners. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $listeners; |
||
31 | |||
32 | /** |
||
33 | * All registered webhooks. |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $webhooks = []; |
||
37 | |||
38 | /** |
||
39 | * @var Client |
||
40 | */ |
||
41 | protected $client; |
||
42 | |||
43 | /** |
||
44 | * @var \Illuminate\Contracts\Cache\Repository |
||
45 | */ |
||
46 | protected $cache; |
||
47 | |||
48 | /** |
||
49 | * @var \Illuminate\Contracts\Config\Repository |
||
50 | */ |
||
51 | protected $config; |
||
52 | |||
53 | /** |
||
54 | * Bootstrap. |
||
55 | */ |
||
56 | public function boot() |
||
68 | |||
69 | /** |
||
70 | * Register the service provider. |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | public function register() |
||
78 | |||
79 | /** |
||
80 | * Publish migration. |
||
81 | */ |
||
82 | protected function publishMigration() |
||
83 | { |
||
84 | $migrations = [ |
||
85 | __DIR__.'/../../database/2015_10_29_000000_captain_hook_setup_table.php' => |
||
86 | database_path('/migrations/2015_10_29_000000_captain_hook_setup_table.php'), |
||
87 | __DIR__.'/../../database/2015_10_29_000001_captain_hook_setup_logs_table.php' => |
||
88 | database_path('/migrations/2015_10_29_000001_captain_hook_setup_logs_table.php'), |
||
89 | ]; |
||
90 | |||
91 | // To be backwards compatible |
||
92 | foreach ($migrations as $migration => $toPath) { |
||
93 | preg_match('/_captain_hook_.*\.php/', $migration, $match); |
||
94 | $published_migration = glob(database_path('/migrations/*'.$match[0])); |
||
95 | if (count($published_migration) !== 0) { |
||
96 | unset($migrations[$migration]); |
||
97 | } |
||
98 | } |
||
99 | |||
100 | $this->publishes($migrations, 'migrations'); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Publish configuration file. |
||
105 | */ |
||
106 | protected function publishConfig() |
||
112 | |||
113 | protected function publishSparkResources() |
||
122 | |||
123 | /** |
||
124 | * Register all active event listeners. |
||
125 | */ |
||
126 | protected function registerEventListeners() |
||
132 | |||
133 | /** |
||
134 | * @param array $listeners |
||
135 | */ |
||
136 | public function setListeners($listeners) |
||
142 | |||
143 | /** |
||
144 | * @param array $webhooks |
||
145 | */ |
||
146 | public function setWebhooks($webhooks) |
||
153 | |||
154 | /** |
||
155 | * @return \Illuminate\Support\Collection |
||
156 | */ |
||
157 | public function getWebhooks() |
||
158 | { |
||
159 | // Check if migration ran |
||
160 | if (Schema::hasTable((new Webhook)->getTable())) { |
||
161 | return collect($this->getCache()->rememberForever(Webhook::CACHE_KEY, function () { |
||
162 | return Webhook::all(); |
||
163 | })); |
||
164 | } |
||
165 | |||
166 | return collect(); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * @return \Illuminate\Contracts\Cache\Repository |
||
171 | */ |
||
172 | public function getCache() |
||
176 | |||
177 | /** |
||
178 | * @param \Illuminate\Contracts\Cache\Repository $cache |
||
179 | */ |
||
180 | public function setCache($cache) |
||
184 | |||
185 | /** |
||
186 | * @param ClientInterface $client |
||
187 | */ |
||
188 | public function setClient($client) |
||
192 | |||
193 | /** |
||
194 | * @param \Illuminate\Contracts\Config\Repository $config |
||
195 | */ |
||
196 | public function setConfig($config) |
||
200 | |||
201 | /** |
||
202 | * Event listener. |
||
203 | * |
||
204 | * @param $eventData |
||
205 | */ |
||
206 | public function handleEvent($eventData) |
||
216 | |||
217 | /** |
||
218 | * Register the artisan commands. |
||
219 | */ |
||
220 | protected function registerCommands() |
||
228 | |||
229 | /** |
||
230 | * Register predefined routes used for Spark. |
||
231 | */ |
||
232 | protected function registerRoutes() |
||
238 | } |
||
239 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..