Code Duplication    Length = 19-19 lines in 2 locations

src/RancherApi.php 1 location

@@ 97-115 (lines=19) @@
94
95
    }
96
97
    private function executeOn($container)
98
    {
99
        $response = $this->client->post($container->actions->execute, [
100
            "attachStdin" => true,
101
            "attachStdout" => true,
102
            "command" =>
103
                array_merge([$this->args['commandArg']], $this->args['params']),
104
            "tty" => false
105
        ], true);
106
107
        $contents = json_decode($response->getBody()->getContents(), true);
108
109
        if ($this->client->isSocket()) {
110
111
            $wsClient = new WSClient();
112
113
            $wsClient->socketConnect($contents['url'], $contents['token']);
114
        }
115
    }
116
117
    /**
118
     * @param bool $onAllContainers

tests/RancherApiTest.php 1 location

@@ 92-110 (lines=19) @@
89
90
    }
91
92
    private function executeOn($container)
93
    {
94
        $response = $this->client->post($container->actions->execute, [
95
            "attachStdin" => true,
96
            "attachStdout" => true,
97
            "command" =>
98
                array_merge([$this->args['commandArg']], $this->args['params']),
99
            "tty" => false
100
        ], true);
101
102
        $contents = json_decode($response->getBody()->getContents(), true);
103
104
        if ($this->client->isSocket()) {
105
106
            $wsClient = new WSClient();
107
108
            $wsClient->socketConnect($contents['url'], $contents['token']);
109
        }
110
    }
111
112
    public function execute()
113
    {