Completed
Pull Request — master (#147)
by Joel
08:20 queued 05:59
created

ExecManager::start()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 4.3731

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 12
loc 12
ccs 5
cts 7
cp 0.7143
rs 9.2
cc 4
eloc 6
nc 3
nop 4
crap 4.3731
1
<?php
2
3
namespace Docker\Manager;
4
5
use Docker\API\Resource\ExecResource;
6
use Docker\Stream\DockerRawStream;
7
8
class ExecManager extends ExecResource
9
{
10
    const FETCH_STREAM = 'stream';
11
12 1 View Code Duplication
    public function start($id, \Docker\API\Model\ExecStartConfig $execStartConfig, $parameters = [], $fetch = self::FETCH_OBJECT)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
    {
14 1
        $response = parent::start($id, $execStartConfig, $parameters, $fetch);
15
16 1
        if ($response->getStatusCode() == 200 && DockerRawStream::HEADER == $response->getHeaderLine('Content-Type')) {
17 1
            if ($fetch == self::FETCH_STREAM) {
18 1
                return new DockerRawStream($response->getBody());
19
            }
20
        }
21
22
        return $response;
23
    }
24
25
}
26