LullabotAmpConverter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A convertToAmp() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the takeit/AmpHtmlBundle package.
5
 *
6
 * (c) Rafał Muszyński <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Takeit\Bundle\AmpHtmlBundle\Converter;
13
14
use Lullabot\AMP\Validate\Scope;
15
use Lullabot\AMP\AMP;
16
17
/**
18
 * HTML to AMP HTML converter.
19
 *
20
 * @author Rafał Muszyński <[email protected]>
21
 */
22
class LullabotAmpConverter implements AmpConverterInterface
23
{
24
    /**
25
     * @var AMP
26
     */
27
    private $ampConverter;
28
29
    /**
30
     * @param AMP $ampConverter
31
     */
32
    public function __construct(AMP $ampConverter)
33
    {
34
        $this->ampConverter = $ampConverter;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function convertToAmp($html)
41
    {
42
        $this->ampConverter->loadHtml($html, ['scope' => Scope::HTML_SCOPE]);
43
44
        return $this->ampConverter->convertToAmpHtml();
45
    }
46
}
47