Code Duplication    Length = 5-5 lines in 3 locations

class/stats.php 3 locations

@@ 396-400 (lines=5) @@
393
    {
394
        $handler = $this->loadHandler('write');
395
396
        if (!$object->isDirty()) {
397
            trigger_error("Data entry is not inserted - the object '" . get_class($object) . "' is not dirty," . "' with errors: " . implode(', ', $object->getErrors()), E_USER_NOTICE);
398
399
            return $object->getVar($this->keyName);
400
        }
401
        if (!$handler->cleanVars($object)) {
402
            trigger_error("Insert failed in method 'cleanVars' of object '" . get_class($object) . "' with errors: " . implode(', ', $object->getErrors()), E_USER_WARNING);
403
@@ 401-405 (lines=5) @@
398
399
            return $object->getVar($this->keyName);
400
        }
401
        if (!$handler->cleanVars($object)) {
402
            trigger_error("Insert failed in method 'cleanVars' of object '" . get_class($object) . "' with errors: " . implode(', ', $object->getErrors()), E_USER_WARNING);
403
404
            return $object->getVar($this->keyName);
405
        }
406
        $queryFunc = empty($force) ? 'query' : 'queryF';
407
408
        if ($object->isNew()) {
@@ 414-418 (lines=5) @@
411
                $keys = array_keys($object->cleanVars);
412
                $vals = array_values($object->cleanVars);
413
                $sql  .= ' (' . implode(', ', $keys) . ') VALUES (' . implode(',', $vals) . ')';
414
            } else {
415
                trigger_error("Data entry is not inserted - no variable is changed in object of '" . get_class($object) . "' with errors: " . implode(', ', $object->getErrors()), E_USER_NOTICE);
416
417
                return $object->getVar($this->keyName);
418
            }
419
            // START ON DUPLICATE KEY UPDATE
420
            if (!empty($duplicate)) {
421
                $sql  .= ' ON DUPLICATE KEY UPDATE';