Reader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A read() 0 6 1
1
<?php
2
3
namespace Graze\CsvToken;
4
5
use Graze\CsvToken\Csv\CsvConfigurationInterface;
6
use Graze\CsvToken\Tokeniser\StreamTokeniser;
7
use Iterator;
8
9
class Reader
10
{
11
    /** @var resource */
12
    private $stream;
13
    /** @var CsvConfigurationInterface */
14
    private $config;
15
16
    /**
17
     * Reader constructor.
18
     *
19
     * @param CsvConfigurationInterface $config
20
     * @param resource                  $stream
21
     */
22 1
    public function __construct(CsvConfigurationInterface $config, $stream)
23
    {
24 1
        $this->stream = $stream;
25 1
        $this->config = $config;
26 1
    }
27
28
    /**
29
     * @return Iterator Iterator of csv line arrays
30
     */
31 1
    public function read()
32
    {
33 1
        $tokens = new StreamTokeniser($this->config, $this->stream);
34 1
        $parser = new Parser();
35 1
        return $parser->parse($tokens->getTokens());
36
    }
37
}
38