Code Duplication    Length = 7-13 lines in 3 locations

src/Helper/XMLParser.php 3 locations

@@ 286-292 (lines=7) @@
283
                    /// since the case() in which we are already did that
284
                    if ($name == 'STRING') {
285
                        $this->_xh['value'] = $this->_xh['ac'];
286
                    } elseif ($name == 'DATETIME.ISO8601') {
287
                        if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) {
288
                            error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']);
289
                        }
290
                        $this->_xh['vt'] = Value::$xmlrpcDateTime;
291
                        $this->_xh['value'] = $this->_xh['ac'];
292
                    } elseif ($name == 'BASE64') {
293
                        /// @todo check for failure of base64 decoding / catch warnings
294
                        $this->_xh['value'] = base64_decode($this->_xh['ac']);
295
                    } elseif ($name == 'BOOLEAN') {
@@ 311-323 (lines=13) @@
308
                            }
309
                            $this->_xh['value'] = false;
310
                        }
311
                    } elseif ($name == 'DOUBLE') {
312
                        // we have a DOUBLE
313
                        // we must check that only 0123456789-.<space> are characters here
314
                        // NOTE: regexp could be much stricter than this...
315
                        if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) {
316
                            /// @todo: find a better way of throwing an error than this!
317
                            error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']);
318
                            $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
319
                        } else {
320
                            // it's ok, add it on
321
                            $this->_xh['value'] = (double)$this->_xh['ac'];
322
                        }
323
                    } else {
324
                        // we have an I4/I8/INT
325
                        // we must check that only 0123456789-<space> are characters here
326
                        if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) {
@@ 326-333 (lines=8) @@
323
                    } else {
324
                        // we have an I4/I8/INT
325
                        // we must check that only 0123456789-<space> are characters here
326
                        if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) {
327
                            /// @todo find a better way of throwing an error than this!
328
                            error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']);
329
                            $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
330
                        } else {
331
                            // it's ok, add it on
332
                            $this->_xh['value'] = (int)$this->_xh['ac'];
333
                        }
334
                    }
335
                    $this->_xh['lv'] = 3; // indicate we've found a value
336
                    break;