Code Duplication    Length = 9-10 lines in 4 locations

PHPDaemon/Clients/XMPP/Connection.php 4 locations

@@ 121-129 (lines=9) @@
118
     * @callback $cb ( )
119
     * @return boolean
120
     */
121
    public function iqSet($xml, $cb)
122
    {
123
        if (!isset($this->xml)) {
124
            return false;
125
        }
126
        $id = $this->getId();
127
        $this->xml->addIdHandler($id, $cb);
128
        $this->sendXML('<iq xmlns="jabber:client" type="set" id="' . $id . '">' . $xml . '</iq>');
129
        return true;
130
    }
131
132
    /**
@@ 140-149 (lines=10) @@
137
     * @callback $cb ( )
138
     * @return boolean
139
     */
140
    public function iqSetTo($to, $xml, $cb)
141
    {
142
        if (!isset($this->xml)) {
143
            return false;
144
        }
145
        $id = $this->getId();
146
        $this->xml->addIdHandler($id, $cb);
147
        $this->sendXML('<iq xmlns="jabber:client" type="set" id="' . $id . '" to="' . htmlspecialchars($to) . '">' . $xml . '</iq>');
148
        return true;
149
    }
150
151
    /**
152
     * @TODO DESCR
@@ 158-166 (lines=9) @@
155
     * @callback $cb ( )
156
     * @return boolean
157
     */
158
    public function iqGet($xml, $cb)
159
    {
160
        if (!isset($this->xml)) {
161
            return false;
162
        }
163
        $id = $this->getId();
164
        $this->xml->addIdHandler($id, $cb);
165
        $this->sendXML('<iq xmlns="jabber:client" type="get" id="' . $id . '">' . $xml . '</iq>');
166
        return true;
167
    }
168
169
    /**
@@ 177-186 (lines=10) @@
174
     * @callback $cb ( )
175
     * @return boolean
176
     */
177
    public function iqGetTo($to, $xml, $cb)
178
    {
179
        if (!isset($this->xml)) {
180
            return false;
181
        }
182
        $id = $this->getId();
183
        $this->xml->addIdHandler($id, $cb);
184
        $this->sendXML('<iq xmlns="jabber:client" type="get" id="' . $id . '" to="' . htmlspecialchars($to) . '">' . $xml . '</iq>');
185
        return true;
186
    }
187
188
    /**
189
     * @TODO DESCR