Completed
Push — 1.x ( ee8545...084efb )
by Joel
02:48
created

BuildStream::readFrame()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 16
rs 9.4286
cc 3
eloc 8
nc 3
nop 0
1
<?php
2
3
namespace Docker\Stream;
4
5
/**
6
 * Represent a stream when building a dockerfile
7
 *
8
 * Callable(s) passed to this stream will take a BuildFrame object as the first argument
9
 */
10
class BuildStream extends MultiJsonStream
11
{
12
    /**
13
     * {@inheritdoc}
14
     *
15
     * @return BuildFrame|null
16
     */
17
    protected function readFrame()
18
    {
19
        $frame = parent::readFrame();
20
21
        if ($frame === null) {
22
            return null;
23
        }
24
25
        $buildFrame = new BuildFrame();
26
27
        if (isset($frame->stream)) {
28
            $buildFrame->setStream($frame->stream);
29
        }
30
31
        return $buildFrame;
32
    }
33
}
34