Code Duplication    Length = 28-28 lines in 2 locations

src/Generics/Socket/SecureSocket.php 2 locations

@@ 91-118 (lines=28) @@
88
     * {@inheritdoc}
89
     * @see \Generics\Streams\Stream::ready()
90
     */
91
    public function ready(): bool
92
    {
93
        if (! is_resource($this->handle)) {
94
            return false;
95
        }
96
        
97
        $read = array(
98
            $this->handle
99
        );
100
        $write = null;
101
        $except = null;
102
        
103
        $num = @stream_select($read, $write, $except, 0);
104
        
105
        if ($num === false) {
106
            throw new SocketException("Could not determine the stream client status");
107
        }
108
        
109
        if ($num < 1) {
110
            return false;
111
        }
112
        
113
        if (! in_array($this->handle, $read)) {
114
            return false;
115
        }
116
        
117
        return true;
118
    }
119
120
    /**
121
     *
@@ 194-221 (lines=28) @@
191
     * {@inheritdoc}
192
     * @see \Generics\Streams\OutputStream::isWriteable()
193
     */
194
    public function isWriteable(): bool
195
    {
196
        if (! is_resource($this->handle)) {
197
            return false;
198
        }
199
        
200
        $read = null;
201
        $write = array(
202
            $this->handle
203
        );
204
        $except = null;
205
        
206
        $num = @stream_select($read, $write, $except, 0, 0);
207
        
208
        if ($num === false) {
209
            throw new SocketException("Could not determine the stream client status");
210
        }
211
        
212
        if ($num < 1) {
213
            return false;
214
        }
215
        
216
        if (! in_array($this->handle, $write)) {
217
            return false;
218
        }
219
        
220
        return true;
221
    }
222
223
    private function open()
224
    {