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

InvalidApp   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A notFound() 0 4 1
A valueIsRequired() 0 4 1
A getSolution() 0 8 1
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