| Conditions | 6 |
| Paths | 7 |
| Total Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | private function initIsConnect() |
||
| 15 | { |
||
| 16 | if (! filter_var(config('bigbluebutton.BBB_SERVER_BASE_URL'), FILTER_VALIDATE_URL)) { |
||
| 17 | return [ |
||
| 18 | 'flag' => false, |
||
| 19 | 'message' => 'invalid url', |
||
| 20 | ]; |
||
| 21 | } |
||
| 22 | |||
| 23 | try { |
||
| 24 | $response = $this->bbb->isMeetingRunning( |
||
|
|
|||
| 25 | new IsMeetingRunningParameters('connection_check') |
||
| 26 | ); |
||
| 27 | |||
| 28 | // url and secret working |
||
| 29 | if ($response->success()) { |
||
| 30 | return ['flag' => true]; |
||
| 31 | } |
||
| 32 | |||
| 33 | // Checksum error - invalid secret |
||
| 34 | if ($response->failed() && $response->getMessageKey() == 'checksumError') { |
||
| 35 | return [ |
||
| 36 | 'flag' => false, |
||
| 37 | 'message' => 'invalid secret key', |
||
| 38 | ]; |
||
| 39 | } |
||
| 40 | |||
| 41 | // HTTP exception or XML parse |
||
| 42 | } catch (\Exception $e) { |
||
| 43 | return [ |
||
| 44 | 'flag' => false, |
||
| 45 | 'message' => 'invalid url and secret key', |
||
| 46 | ]; |
||
| 47 | } |
||
| 48 | |||
| 49 | return [ |
||
| 50 | 'flag' => false, |
||
| 51 | 'message' => 'invalid url', |
||
| 52 | ]; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
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: