Code Duplication    Length = 7-13 lines in 3 locations

src/Helper/XMLParser.php 3 locations

@@ 396-402 (lines=7) @@
393
                    /// since the case() in which we are already did that
394
                    if ($name == 'STRING') {
395
                        $this->_xh['value'] = $this->_xh['ac'];
396
                    } elseif ($name == 'DATETIME.ISO8601') {
397
                        if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $this->_xh['ac'])) {
398
                            error_log('XML-RPC: ' . __METHOD__ . ': invalid value received in DATETIME: ' . $this->_xh['ac']);
399
                        }
400
                        $this->_xh['vt'] = Value::$xmlrpcDateTime;
401
                        $this->_xh['value'] = $this->_xh['ac'];
402
                    } elseif ($name == 'BASE64') {
403
                        /// @todo check for failure of base64 decoding / catch warnings
404
                        $this->_xh['value'] = base64_decode($this->_xh['ac']);
405
                    } elseif ($name == 'BOOLEAN') {
@@ 421-433 (lines=13) @@
418
                            }
419
                            $this->_xh['value'] = false;
420
                        }
421
                    } elseif ($name == 'DOUBLE') {
422
                        // we have a DOUBLE
423
                        // we must check that only 0123456789-.<space> are characters here
424
                        // NOTE: regexp could be much stricter than this...
425
                        if (!preg_match('/^[+-eE0123456789 \t.]+$/', $this->_xh['ac'])) {
426
                            /// @todo: find a better way of throwing an error than this!
427
                            error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in DOUBLE: ' . $this->_xh['ac']);
428
                            $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
429
                        } else {
430
                            // it's ok, add it on
431
                            $this->_xh['value'] = (double)$this->_xh['ac'];
432
                        }
433
                    } else {
434
                        // we have an I4/I8/INT
435
                        // we must check that only 0123456789-<space> are characters here
436
                        if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) {
@@ 436-443 (lines=8) @@
433
                    } else {
434
                        // we have an I4/I8/INT
435
                        // we must check that only 0123456789-<space> are characters here
436
                        if (!preg_match('/^[+-]?[0123456789 \t]+$/', $this->_xh['ac'])) {
437
                            /// @todo find a better way of throwing an error than this!
438
                            error_log('XML-RPC: ' . __METHOD__ . ': non numeric value received in INT: ' . $this->_xh['ac']);
439
                            $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
440
                        } else {
441
                            // it's ok, add it on
442
                            $this->_xh['value'] = (int)$this->_xh['ac'];
443
                        }
444
                    }
445
                    $this->_xh['lv'] = 3; // indicate we've found a value
446
                    break;