1 | <?php |
||
8 | class DatabaseDriver implements StatisticsDriver |
||
9 | { |
||
10 | /** |
||
11 | * The model that controls the database table. |
||
12 | * |
||
13 | * @var \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry|null |
||
14 | */ |
||
15 | protected $record; |
||
16 | |||
17 | /** |
||
18 | * Initialize the driver. |
||
19 | * |
||
20 | * @param \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry|null $record |
||
21 | * @return void |
||
|
|||
22 | */ |
||
23 | public function __construct($record = null) |
||
27 | |||
28 | /** |
||
29 | * Get the app ID for the stats. |
||
30 | * |
||
31 | * @return mixed |
||
32 | */ |
||
33 | public function getAppId() |
||
37 | |||
38 | /** |
||
39 | * Get the time value. Should be Y-m-d H:i:s. |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getTime(): string |
||
47 | |||
48 | /** |
||
49 | * Get the peak connection count for the time. |
||
50 | * |
||
51 | * @return int |
||
52 | */ |
||
53 | public function getPeakConnectionCount(): int |
||
57 | |||
58 | /** |
||
59 | * Get the websocket messages count for the time. |
||
60 | * |
||
61 | * @return int |
||
62 | */ |
||
63 | public function getWebsocketMessageCount(): int |
||
67 | |||
68 | /** |
||
69 | * Get the API message count for the time. |
||
70 | * |
||
71 | * @return int |
||
72 | */ |
||
73 | public function getApiMessageCount(): int |
||
77 | |||
78 | /** |
||
79 | * Create a new statistic in the store. |
||
80 | * |
||
81 | * @param array $data |
||
82 | * @return \BeyondCode\LaravelWebSockets\Statistics\Drivers\StatisticsDriver |
||
83 | */ |
||
84 | public static function create(array $data): StatisticsDriver |
||
90 | |||
91 | /** |
||
92 | * Get the records to show to the dashboard. |
||
93 | * |
||
94 | * @param mixed $appId |
||
95 | * @param \Illuminate\Http\Request|null $request |
||
96 | * @return array |
||
97 | */ |
||
98 | public static function get($appId, ?Request $request): array |
||
130 | |||
131 | /** |
||
132 | * Delete statistics from the store, |
||
133 | * optionally by app id, returning |
||
134 | * the number of deleted records. |
||
135 | * |
||
136 | * @param mixed $appId |
||
137 | * @return int |
||
138 | */ |
||
139 | public static function delete($appId = null): int |
||
153 | } |
||
154 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.