| Conditions | 5 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 14 |
| Ratio | 66.67 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public static function parse_video_id($url, $provider = 'youtube') { |
||
| 32 | switch (strtolower($provider)) { |
||
| 33 | View Code Duplication | case 'youtube': |
|
| 34 | |||
| 35 | if (preg_match(static::config()->patterns['youtube'], $url, $matches)) { |
||
| 36 | return $matches[1]; |
||
| 37 | } |
||
| 38 | |||
| 39 | break; |
||
| 40 | |||
| 41 | View Code Duplication | case 'vimeo': |
|
| 42 | |||
| 43 | if (preg_match(static::config()->patterns['vimeo'], $url, $matches)) { |
||
| 44 | return $matches[3]; |
||
| 45 | } |
||
| 46 | |||
| 47 | break; |
||
| 48 | } |
||
| 49 | |||
| 50 | throw new ProviderNotFound('Provider not found when parsing video id by given url'); |
||
| 51 | } |
||
| 52 | |||
| 65 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.