Code Duplication    Length = 6-7 lines in 2 locations

api/src/Storage/Base.php 2 locations

@@ 629-634 (lines=6) @@
626
			{
627
				if (!$this->autoinc_id || $db_col != $this->autoinc_id)	// not write auto-inc-id
628
				{
629
					if (!array_key_exists($col,$this->data) && 	// handling of unset columns in $this->data
630
						(isset($this->table_def['fd'][$db_col]['default']) ||	// we have a default value
631
						 !isset($this->table_def['fd'][$db_col]['nullable']) || $this->table_def['fd'][$db_col]['nullable']))	// column is nullable
632
					{
633
						continue;	// no need to write that (unset) column
634
					}
635
					if ($this->table_def['fd'][$db_col]['type'] == 'varchar' &&
636
						strlen($this->data[$col]) > $this->table_def['fd'][$db_col]['precision'])
637
					{
@@ 661-667 (lines=7) @@
658
				// we need to update columns set to null: after a $this->data[$col]=null:
659
				// - array_key_exits($col,$this->data) === true
660
				// - isset($this->data[$col]) === false
661
				if (!array_key_exists($col,$this->data) &&	// handling of unset columns in $this->data
662
					($this->autoinc_id ||			// update of table with auto id or
663
					 isset($this->table_def['fd'][$db_col]['default']) ||	// we have a default value or
664
					 !isset($this->table_def['fd'][$db_col]['nullable']) || $this->table_def['fd'][$db_col]['nullable']))	// column is nullable
665
				{
666
					continue;	// no need to write that (unset) column
667
				}
668
				$data[$db_col] = !is_object($this->data[$col]) && (string) $this->data[$col] === '' && $this->empty_on_write == 'NULL' ? null : $this->data[$col];
669
			}
670
			// allow to add direct sql updates, eg. "etag=etag+1" with int keys