Conditions | 6 |
Paths | 7 |
Total Lines | 40 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | private function initIsConnect() |
||
17 | { |
||
18 | if (!filter_var(config('bigbluebutton.BBB_SERVER_BASE_URL'), FILTER_VALIDATE_URL)) { |
||
19 | return [ |
||
20 | 'flag' => false, |
||
21 | 'message' => 'invalid url' |
||
22 | ]; |
||
23 | } |
||
24 | |||
25 | try { |
||
26 | $response = $this->bbb->isMeetingRunning( |
||
|
|||
27 | new IsMeetingRunningParameters('connection_check') |
||
28 | ); |
||
29 | |||
30 | // url and secret working |
||
31 | if ($response->success()) { |
||
32 | return ['flag' => true]; |
||
33 | } |
||
34 | |||
35 | // Checksum error - invalid secret |
||
36 | if ($response->failed() && $response->getMessageKey() == "checksumError") { |
||
37 | return [ |
||
38 | 'flag' => false, |
||
39 | 'message' => 'invalid secret key' |
||
40 | ]; |
||
41 | } |
||
42 | |||
43 | // HTTP exception or XML parse |
||
44 | } catch (\Exception $e) { |
||
45 | return [ |
||
46 | 'flag' => false, |
||
47 | 'message' => 'invalid url and secret key' |
||
48 | ]; |
||
49 | } |
||
50 | |||
51 | return [ |
||
52 | 'flag' => false, |
||
53 | 'message' => 'invalid url' |
||
54 | ]; |
||
55 | } |
||
56 | } |
||
57 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: