| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | protected function validateUrl() |
||
| 26 | { |
||
| 27 | |||
| 28 | if (preg_match('~didacte\.com/a/course/(:?[^ ]+)$~i', $this->url) && preg_match('~([^ ]+)\.didacte\.com/a/course/~i', $this->url, $m)) { |
||
| 29 | // We need the subdomain for the oembed endpoint |
||
| 30 | $this->apiUrl = str_replace('{m}', $m['1'], $this->apiUrl); |
||
| 31 | return true; |
||
| 32 | } |
||
| 33 | |||
| 34 | return false; |
||
| 35 | } |
||
| 36 | } |
||
| 39 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.