Test Failed
Push — 1.0.0 ( d3c3e6...4505d9 )
by Zaahid
04:05
created

StreamDecoderFactory::newBase64StreamDecorator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the ZBateson\MailMimeParser project.
4
 *
5
 * @license http://opensource.org/licenses/bsd-license.php BSD
6
 */
7
namespace ZBateson\MailMimeParser\Stream;
8
9
use GuzzleHttp\Psr7;
10
use GuzzleHttp\Psr7\StreamWrapper;
11
use ZBateson\StreamDecorators\Base64StreamDecorator;
12
use ZBateson\StreamDecorators\QuotedPrintableStreamDecorator;
13
use ZBateson\StreamDecorators\UUStreamDecorator;
14
use ZBateson\StreamDecorators\CharsetStreamDecorator;
15
16
/**
17
 * Description of StreamFactory
18
 *
19
 * @author Zaahid Bateson <[email protected]>
20
 */
21
class StreamDecoderFactory
22
{
23
    public function newBase64StreamDecorator($resource)
24
    {
25
        $stream = new Base64StreamDecorator(Psr7\stream_for($resource));
0 ignored issues
show
Bug introduced by
The function stream_for was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        $stream = new Base64StreamDecorator(/** @scrutinizer ignore-call */ Psr7\stream_for($resource));
Loading history...
26
        return StreamWrapper::getResource($stream);
27
    }
28
29
    public function newQuotedPrintableStreamDecorator($resource)
30
    {
31
        $stream = new QuotedPrintableStreamDecorator(Psr7\stream_for($resource));
0 ignored issues
show
Bug introduced by
The function stream_for was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        $stream = new QuotedPrintableStreamDecorator(/** @scrutinizer ignore-call */ Psr7\stream_for($resource));
Loading history...
32
        return StreamWrapper::getResource($stream);
33
    }
34
35
    public function newUUStreamDecorator($resource)
36
    {
37
        $stream = new UUStreamDecorator(Psr7\stream_for($resource));
0 ignored issues
show
Bug introduced by
The function stream_for was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        $stream = new UUStreamDecorator(/** @scrutinizer ignore-call */ Psr7\stream_for($resource));
Loading history...
38
        return StreamWrapper::getResource($stream);
39
    }
40
41
    public function newCharsetStreamDecorator($resource, $fromCharset, $toCharset)
42
    {
43
        $stream = new CharsetStreamDecorator(Psr7\stream_for($resource), $fromCharset, $toCharset);
0 ignored issues
show
Bug introduced by
The function stream_for was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        $stream = new CharsetStreamDecorator(/** @scrutinizer ignore-call */ Psr7\stream_for($resource), $fromCharset, $toCharset);
Loading history...
44
        return StreamWrapper::getResource($stream);
45
    }
46
}
47