Code Duplication    Length = 20-20 lines in 2 locations

generated/Resource/ContainerResource.php 1 location

@@ 61-80 (lines=20) @@
58
     *
59
     * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ContainerCreateResult
60
     */
61
    public function create(\Docker\API\Model\ContainerConfig $container, $parameters = [], $fetch = self::FETCH_OBJECT)
62
    {
63
        $queryParam = new QueryParam();
64
        $queryParam->setDefault('name', null);
65
        $queryParam->setDefault('Content-Type', 'application/json');
66
        $queryParam->setHeaderParameters(['Content-Type']);
67
        $url      = '/containers/create';
68
        $url      = $url . ('?' . $queryParam->buildQueryString($parameters));
69
        $headers  = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters));
70
        $body     = $this->serializer->serialize($container, 'json');
71
        $request  = $this->messageFactory->createRequest('POST', $url, $headers, $body);
72
        $response = $this->httpClient->sendRequest($request);
73
        if (self::FETCH_OBJECT == $fetch) {
74
            if ('201' == $response->getStatusCode()) {
75
                return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\ContainerCreateResult', 'json');
76
            }
77
        }
78
79
        return $response;
80
    }
81
82
    /**
83
     * Return low-level information on the container id.

generated/Resource/ExecResource.php 1 location

@@ 22-41 (lines=20) @@
19
     *
20
     * @return \Psr\Http\Message\ResponseInterface|\Docker\API\Model\ExecCreateResult
21
     */
22
    public function create($id, \Docker\API\Model\ExecConfig $execConfig, $parameters = [], $fetch = self::FETCH_OBJECT)
23
    {
24
        $queryParam = new QueryParam();
25
        $queryParam->setDefault('Content-Type', 'application/json');
26
        $queryParam->setHeaderParameters(['Content-Type']);
27
        $url      = '/containers/{id}/exec';
28
        $url      = str_replace('{id}', $id, $url);
29
        $url      = $url . ('?' . $queryParam->buildQueryString($parameters));
30
        $headers  = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters));
31
        $body     = $this->serializer->serialize($execConfig, 'json');
32
        $request  = $this->messageFactory->createRequest('POST', $url, $headers, $body);
33
        $response = $this->httpClient->sendRequest($request);
34
        if (self::FETCH_OBJECT == $fetch) {
35
            if ('201' == $response->getStatusCode()) {
36
                return $this->serializer->deserialize($response->getBody()->getContents(), 'Docker\\API\\Model\\ExecCreateResult', 'json');
37
            }
38
        }
39
40
        return $response;
41
    }
42
43
    /**
44
     * Starts a previously set up exec instance id. If detach is true, this API returns after starting the exec command. Otherwise, this API sets up an interactive session with the exec command.