Code Duplication    Length = 7-13 lines in 3 locations

src/Helper/XMLParser.php 3 locations

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