forked from laravel/reverb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.php
More file actions
124 lines (111 loc) · 2.54 KB
/
Application.php
File metadata and controls
124 lines (111 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
namespace Laravel\Reverb;
class Application
{
/**
* Create a new application instance.
*/
public function __construct(
protected string $id,
protected string $key,
protected string $secret,
protected int $pingInterval,
protected int $activityTimeout,
protected array $allowedOrigins,
protected int $maxMessageSize,
protected ?int $maxConnections = null,
protected array $options = [],
) {
//
}
/**
* Get the application ID.
*/
public function id(): string
{
return $this->id;
}
/**
* Get the application key.
*/
public function key(): string
{
return $this->key;
}
/**
* Get the application secret.
*/
public function secret(): string
{
return $this->secret;
}
/**
* Get the allowed origins.
*
* @return array<int, string>
*/
public function allowedOrigins(): array
{
return $this->allowedOrigins;
}
/**
* Get the client ping interval in seconds.
*/
public function pingInterval(): int
{
return $this->pingInterval;
}
/**
* Get the activity timeout in seconds.
*/
public function activityTimeout(): int
{
return $this->activityTimeout;
}
/**
* Get the maximum connections allowed for the application.
*/
public function maxConnections(): ?int
{
return $this->maxConnections;
}
/**
* Determine if the application has a maximum connection limit.
*/
public function hasMaxConnectionLimit(): bool
{
return $this->maxConnections !== null;
}
/**
* Get the maximum message size allowed from the client.
*/
public function maxMessageSize(): int
{
return $this->maxMessageSize;
}
/**
* Get the application options.
*/
public function options(): ?array
{
return $this->options;
}
/**
* Convert the application to an array.
*
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'app_id' => $this->id,
'key' => $this->key,
'secret' => $this->secret,
'ping_interval' => $this->pingInterval,
'activity_timeout' => $this->activityTimeout,
'allowed_origins' => $this->allowedOrigins,
'max_message_size' => $this->maxMessageSize,
'options' => $this->options,
];
}
}