Code Duplication    Length = 19-19 lines in 2 locations

src/SSH/Driver/Sftp.php 1 location

@@ 126-144 (lines=19) @@
123
     * @override
124
     * @inheritDoc
125
     */
126
    public function connect()
127
    {
128
        if ($this->resource !== null)
129
        {
130
            return;
131
        }
132
133
        $resource = $this->createConnection($this->conn);
134
135
        if (!$resource || !is_resource($resource))
136
        {
137
            $this->emit('error', [ $this, new ExecutionException('SSH2:Sftp could not be connected.') ]);
138
            return;
139
        }
140
141
        $this->resource = $resource;
142
143
        $this->emit('connect', [ $this ]);
144
    }
145
146
    /**
147
     * @override

src/SSH/Driver/Shell.php 1 location

@@ 123-141 (lines=19) @@
120
     * @override
121
     * @inheritDoc
122
     */
123
    public function connect()
124
    {
125
        if ($this->resource !== null)
126
        {
127
            return;
128
        }
129
130
        $shell = $this->createConnection($this->conn);
131
132
        if (!$shell || !is_resource($shell))
133
        {
134
            $this->emit('error', [ $this, new ExecutionException('SSH2:Shell could not be connected.') ]);
135
            return;
136
        }
137
138
        $this->resource = $shell;
139
140
        $this->emit('connect', [ $this ]);
141
    }
142
143
    /**
144
     * @override