TestCase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toStream() 0 6 1
A setUp() 0 3 1
1
<?php
2
/**
3
 * This file is part of graze/gigya-client
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/gigya-client/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/gigya-client
12
 */
13
14
namespace Graze\Gigya\Test;
15
16
use GuzzleHttp\Psr7\Stream;
17
18
class TestCase extends \PHPUnit_Framework_TestCase
19
{
20
    public function setUp()
21
    {
22
        date_default_timezone_set('UTC');
23
    }
24
25
    /**
26
     * @param string $text
27
     *
28
     * @return Stream
29
     */
30
    protected function toStream($text)
31
    {
32
        $stream = fopen('php://temp', 'a+');
33
        fwrite($stream, $text);
0 ignored issues
show
Bug introduced by
It seems like $stream can also be of type false; however, parameter $handle of fwrite() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

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

33
        fwrite(/** @scrutinizer ignore-type */ $stream, $text);
Loading history...
34
        rewind($stream);
0 ignored issues
show
Bug introduced by
It seems like $stream can also be of type false; however, parameter $handle of rewind() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

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

34
        rewind(/** @scrutinizer ignore-type */ $stream);
Loading history...
35
        return new Stream($stream);
0 ignored issues
show
Bug introduced by
It seems like $stream can also be of type false; however, parameter $stream of GuzzleHttp\Psr7\Stream::__construct() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

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

35
        return new Stream(/** @scrutinizer ignore-type */ $stream);
Loading history...
36
    }
37
}
38