Completed
Push — master ( 77daf0...6ee4bd )
by Mauro
04:15
created

Document::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/*
3
 * This file is part of the LaVoz 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 2
    public function __construct(SerializerInterface $serializer)
35
    {
36 2
        $this->serializer = $serializer;
37 2
    }
38
39
    /**
40
     * Document generate.
41
     *
42
     * @param AdBag $adBag
43
     *
44
     * @return string
45
     */
46 2
    public function generate(AdBag $adBag)
47
    {
48 2
        return $this->serializer->serialize($adBag, 'xml');
49
    }
50
}