Completed
Push — wip-platform ( 03cba6...2999ab )
by
unknown
05:53 queued 02:49
created

Handler::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
/*
4
 *
5
 * Copyright (C) 2015-2017 Libre Informatique
6
 *
7
 * This file is licenced under the GNU LGPL v3.
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Blast\Bundle\CoreBundle\Exporter;
13
14
use Exporter\Source\SourceIteratorInterface;
15
use Exporter\Writer\WriterInterface;
16
use Exporter\Handler as BaseHandler;
17
18
class Handler extends BaseHandler
19
{
20
    public function export()
21
    {
22
        $this->writer->open();
23
24
        foreach ($this->source as $key => $data) {
25
            $this->writer->write($data);
26
        }
27
28
        $this->writer->close();
29
    }
30
31
    /**
32
     * @param SourceIteratorInterface $source
33
     * @param WriterInterface         $writer
34
     *
35
     * @return Handler
36
     */
37
    public static function create(SourceIteratorInterface $source, WriterInterface $writer)
38
    {
39
        return new self($source, $writer);
40
    }
41
}
42