LocalFileAdapter::receive()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Adapter;
11
12
use Transfer\Adapter\Transaction\Request;
13
use Transfer\Adapter\Transaction\Response;
14
use Transfer\Data\ValueObject;
15
16
/**
17
 * Local file adapter functioning as a source.
18
 */
19
class LocalFileAdapter implements SourceAdapterInterface
20
{
21
    /**
22
     * @var string Filename
23
     */
24
    private $filename;
25
26
    /**
27
     * @param string $filename
28
     */
29 1
    public function __construct($filename)
30
    {
31 1
        $this->filename = $filename;
32 1
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 1
    public function receive(Request $request)
38
    {
39 1
        return new Response(array(
40 1
            new ValueObject(file_get_contents($this->filename)),
41 1
        ));
42
    }
43
}
44