CreateStreamTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createStream() 0 7 1
1
<?php
2
/**
3
 * This file is part of graze/data-file
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/data-file/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-file
12
 */
13
14
namespace Graze\DataFile\Test\Helper;
15
16
trait CreateStreamTrait
17
{
18
    /**
19
     * @param string $string
20
     *
21
     * @return resource
22
     */
23
    protected function createStream($string)
24
    {
25
        $stream = fopen('php://memory', 'r+');
26
        fwrite($stream, $string);
27
        rewind($stream);
28
        return $stream;
29
    }
30
}
31