Completed
Pull Request — master (#7)
by
unknown
05:22
created

YoutubeConverter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 15
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toHtml() 0 7 1
A matches() 0 4 1
1
<?php
2
3
namespace Sioen\JsonToHtml;
4
5
final class YoutubeConverter implements Converter
6
{
7
    public function toHtml(array $data)
8
    {
9
        return sprintf(
10
            '<iframe src="//www.youtube.com/embed/%s?rel=0" frameborder="0" allowfullscreen></iframe>',
11
            $data['remote_id']
12
        );
13
    }
14
15
    public function matches($type)
16
    {
17
        return $type === 'youtube';
18
    }
19
}
20