Code Duplication    Length = 46-46 lines in 2 locations

src/DP/GameServer/MinecraftServerBundle/MinecraftQuery/MinecraftRcon.php 1 location

@@ 95-140 (lines=46) @@
92
        catch (ConnectionFailedException $e) {}
93
    }
94
    
95
    private function auth()
96
    {
97
        if (!$this->fullyConstructed) {
98
            $this->fullConstruct();
99
        }
100
        
101
        if ($this->authenticated == null) {
102
            $id = null;
103
            $packet = $this->packetFactory->getAuthPacket($id, $this->rconPassword);
104
                        
105
            $this->socket->send($packet);
106
            $resp = $this->socket->recv(false);
107
            
108
            if ($resp->isEmpty()) {
109
                $this->authenticated = false;
110
                return;
111
            }
112
            
113
            $infos = $resp->extract(array(
114
                'size' => 'long', 
115
                'id' => 'long', 
116
                'type' => 'long', 
117
                's1' => 'string', 
118
                's2' => 'string'
119
            ));
120
            
121
            if ($infos['type'] == $this->packetFactory->SERVER_RESPONSE_VALUE) {
122
                $resp = $this->socket->recv(false);
123
                $infos = $resp->extract(array(
124
                    'size' => 'long', 
125
                    'id' => 'long', 
126
                    'type' => 'long', 
127
                    's1' => 'string', 
128
                    's2' => 'string'
129
                ));
130
            }
131
            
132
            if ($infos['id'] == $id && 
133
                $infos['type'] == $this->packetFactory->SERVER_AUTH_RESPONSE) {
134
                $this->authenticated = true;
135
            }
136
            else {
137
                $this->authenticated = false;
138
            }
139
        }
140
    }
141
    
142
    public function sendCmd($cmd)
143
    {

src/DP/GameServer/SteamServerBundle/SteamQuery/SourceRcon.php 1 location

@@ 138-183 (lines=46) @@
135
        catch (ConnectionFailedException $e) {}
136
    }
137
    
138
    private function auth()
139
    {
140
        if (!$this->fullyConstructed) {
141
            $this->fullConstruct();
142
        }
143
        
144
        if ($this->authenticated == null) {
145
            $id = null;
146
            $packet = $this->packetFactory->getAuthPacket($id, $this->rconPassword);
147
                        
148
            $this->socket->send($packet);
149
            $resp = $this->socket->recv(false);
150
            
151
            if ($resp->isEmpty()) {
152
                $this->authenticated = false;
153
                return;
154
            }
155
            
156
            $infos = $resp->extract(array(
157
                'size' => 'long', 
158
                'id' => 'long', 
159
                'type' => 'long', 
160
                's1' => 'string', 
161
                's2' => 'string'
162
            ));
163
            
164
            if ($infos['type'] == $this->packetFactory->SERVER_RESPONSE_VALUE) {
165
                $resp = $this->socket->recv(false);
166
                $infos = $resp->extract(array(
167
                    'size' => 'long', 
168
                    'id' => 'long', 
169
                    'type' => 'long', 
170
                    's1' => 'string', 
171
                    's2' => 'string'
172
                ));
173
            }
174
            
175
            if ($infos['id'] == $id && 
176
                $infos['type'] == $this->packetFactory->SERVER_AUTH_RESPONSE) {
177
                $this->authenticated = true;
178
            }
179
            else {
180
                $this->authenticated = false;
181
            }
182
        }
183
    }
184
    
185
    public function sendCmd($cmd)
186
    {