Code Duplication    Length = 10-11 lines in 2 locations

src/AbstractActiveRecord.php 2 locations

@@ 61-71 (lines=11) @@
58
	 *
59
	 * @return string the create query.
60
	 */
61
	private function getCreateQuery()
62
	{
63
		$columns = array_keys($this->getActiveRecordData());
64
		$values = [];
65
66
		foreach ($columns as $key => $value) {
67
			$values[] = sprintf(':%s', $value);
68
		}
69
70
		return sprintf('INSERT INTO `%s` (`%s`) VALUES (%s)', $this->getActiveRecordName(), implode('`, `', $columns), implode(', ', $values));
71
	}
72
73
	/**
74
	 * {@inheritdoc}
@@ 130-139 (lines=10) @@
127
	 *
128
	 * @return string the update query.
129
	 */
130
	private function getUpdateQuery()
131
	{
132
		$values = [];
133
134
		foreach (array_keys($this->getActiveRecordData()) as $key => $value) {
135
			$values[] = sprintf('`%s` = :%s', $value, $value);
136
		}
137
138
		return sprintf('UPDATE `%s` SET %s WHERE `id` = :id', $this->getActiveRecordName(), implode(', ', $values));
139
	}
140
141
	/**
142
	 * {@inheritdoc}