LocalFileAdapter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A receive() 0 6 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