StringTokeniser::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * This file is part of graze/csv-token
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/csv-token/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/csv-token
12
 */
13
14
namespace Graze\CsvToken\Tokeniser;
15
16
use Graze\CsvToken\Csv\CsvConfigurationInterface;
17
use GuzzleHttp\Psr7\Stream;
18
19
class StringTokeniser extends StreamTokeniser
20
{
21
    /**
22
     * StringTokeniser constructor.
23
     *
24
     * @param CsvConfigurationInterface $config
25
     * @param string                    $csv
26
     */
27 14
    public function __construct(CsvConfigurationInterface $config, $csv)
28
    {
29 14
        $stream = fopen('php://memory', 'r+');
30 14
        fwrite($stream, $csv);
31 14
        rewind($stream);
32 14
        parent::__construct($config, $stream);
33 14
    }
34
}
35