NullParser::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of slick/http
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Slick\Http\Message\Server\BodyParser;
13
14
use Psr\Http\Message\StreamInterface;
15
use Slick\Http\Message\Server\BodyParserInterface;
16
17
/**
18
 * NullParser
19
 *
20
 * @package Slick\Http\Message\Server\BodyParser
21
*/
22
class NullParser implements BodyParserInterface
23
{
24
    /**
25
     * @var StreamInterface
26
     */
27
    private $stream;
28
29
    /**
30
     * Creates NullParser
31
     * @param StreamInterface $stream
32
     */
33
    public function __construct(StreamInterface $stream)
34
    {
35
        $this->stream = $stream;
36
    }
37
38
    /**
39
     * Returns the body stream as text
40
     *
41
     * @return string
42
     */
43
    public function parse()
44
    {
45
        $this->stream->rewind();
46
        return $this->stream->getContents();
47
    }
48
}
49