String::read()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 8
Bugs 0 Features 0
Metric Value
c 8
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Zerg\Field;
4
5
use Zerg\Stream\AbstractStream;
6
7
/**
8
 * String represents string type data.
9
 *
10
 * Data, parsed by this type of field returns as it is in binary file.
11
 *
12
 * @since 0.1
13
 * @package Zerg\Field
14
 */
15
class String extends Scalar
16
{
17
    /**
18
     * Read string from stream as it is.
19
     *
20
     * @param AbstractStream $stream Stream from which read.
21
     * @return string Returned string.
22
     */
23 8
    public function read(AbstractStream $stream)
24
    {
25 8
        return $stream->getBuffer()->read($this->getSize(), $this->getEndian());
26
    }
27
}