| @@ 19-30 (lines=12) @@ | ||
| 16 | * |
|
| 17 | * @return \Psr\Http\Message\ResponseInterface|DockerRawStream |
|
| 18 | */ |
|
| 19 | public function attach($id, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
| 20 | { |
|
| 21 | $response = parent::attach($id, $parameters, $fetch); |
|
| 22 | ||
| 23 | if ($response->getStatusCode() == 200 && DockerRawStream::HEADER == $response->getHeaderLine('Content-Type')) { |
|
| 24 | if ($fetch == self::FETCH_STREAM) { |
|
| 25 | return new DockerRawStream($response->getBody()); |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||
| 29 | return $response; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * {@inheritdoc} |
|
| @@ 12-23 (lines=12) @@ | ||
| 9 | { |
|
| 10 | const FETCH_STREAM = 'stream'; |
|
| 11 | ||
| 12 | public function start($id, \Docker\API\Model\ExecStartConfig $execStartConfig, $parameters = [], $fetch = self::FETCH_OBJECT) |
|
| 13 | { |
|
| 14 | $response = parent::start($id, $execStartConfig, $parameters, $fetch); |
|
| 15 | ||
| 16 | if ($response->getStatusCode() == 200 && DockerRawStream::HEADER == $response->getHeaderLine('Content-Type')) { |
|
| 17 | if ($fetch == self::FETCH_STREAM) { |
|
| 18 | return new DockerRawStream($response->getBody()); |
|
| 19 | } |
|
| 20 | } |
|
| 21 | ||
| 22 | return $response; |
|
| 23 | } |
|
| 24 | ||
| 25 | } |
|
| 26 | ||