Code Duplication    Length = 9-10 lines in 4 locations

PHPDaemon/Clients/XMPP/Connection.php 4 locations

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