Completed
Push — master ( 0ffc19...74c3e0 )
by Marcel
03:38
created

InvalidApp::getSolution()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Exceptions;
4
5
use Exception;
6
use Facade\IgnitionContracts\Solution;
7
use Facade\IgnitionContracts\BaseSolution;
8
use Facade\IgnitionContracts\ProvidesSolution;
9
10
class InvalidApp extends Exception implements ProvidesSolution
11
{
12
    public static function notFound($appId)
13
    {
14
        return new static("Could not find app for app id `{$appId}`.");
15
    }
16
17
    public static function valueIsRequired($name, $appId)
18
    {
19
        return new static("{$name} is required but was empty for app id `{$appId}`.");
20
    }
21
22
    public function getSolution(): Solution
23
    {
24
        return BaseSolution::create('Your application id could not be found')
25
            ->setSolutionDescription('Make sure that your `config/websockets.php` contains the app key you are trying to use.')
26
            ->setDocumentationLinks([
27
                'Configuring WebSocket Apps (official documentation)' => 'https://docs.beyondco.de/laravel-websockets/1.0/basic-usage/pusher.html#configuring-websocket-apps',
28
            ]);
29
    }
30
}
31