Document   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 29
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generate() 0 4 1
1
<?php
2
/*
3
 * This file is part of the La Voz Feed Generator package.
4
 *
5
 * (c) Zephia <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zephia\LaVozFeed;
12
13
use JMS\Serializer\SerializerInterface;
14
use Zephia\LaVozFeed\Entity\AdBag;
15
16
/**
17
 * Class Document
18
 *
19
 * @package Zephia\LaVozFeed
20
 * @author  Mauro Moreno <[email protected]>
21
 */
22
class Document
23
{
24
    /**
25
     * @var SerializerInterface
26
     */
27
    private $serializer;
28
29
    /**
30
     * Document constructor.
31
     *
32
     * @param SerializerInterface $serializer
33
     */
34 4
    public function __construct(SerializerInterface $serializer)
35
    {
36 4
        $this->serializer = $serializer;
37 4
    }
38
39
    /**
40
     * Document generate.
41
     *
42
     * @param AdBag $adBag
43
     *
44
     * @return string
45
     */
46 4
    public function generate(AdBag $adBag)
47
    {
48 4
        return $this->serializer->serialize($adBag, 'xml');
49
    }
50
}