| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | public function toJson(\DOMElement $node) |
||
| 8 | { |
||
| 9 | $html = $node->ownerDocument->saveXML($node); |
||
| 10 | |||
| 11 | // youtube or vimeo |
||
| 12 | if (preg_match('~//www.youtube.com/embed/([^/\?]+).*\"~si', $html, $matches)) { |
||
| 13 | return array( |
||
| 14 | 'type' => 'video', |
||
| 15 | 'data' => array( |
||
| 16 | 'source' => 'youtube', |
||
| 17 | 'remote_id' => $matches[1] |
||
| 18 | ) |
||
| 19 | ); |
||
| 20 | } elseif (preg_match('~//player.vimeo.com/video/([^/\?]+).*\?~si', $html, $matches)) { |
||
| 21 | return array( |
||
| 22 | 'type' => 'video', |
||
| 23 | 'data' => array( |
||
| 24 | 'source' => 'vimeo', |
||
| 25 | 'remote_id' => $matches[1] |
||
| 26 | ) |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 36 |