Code Duplication    Length = 16-21 lines in 2 locations

class/sql_generator.php 1 location

@@ 469-489 (lines=21) @@
466
	 * @param string	$s_split	String used between parts.
467
	 * @return string
468
	 */
469
	protected function GenSqlArray($param, $s_split = ', ')
470
	{
471
		$sql = '';
472
		if (is_array($param) && !empty($param))
473
			// Because of plain format, so $k is useless
474
			foreach ($param as $k=>$v)
475
			{
476
				/*
477
				if (is_int($k))
478
					$sql .= ", $v";
479
				else
480
					$sql .= ", $k $v";
481
				*/
482
				$sql .= "$s_split $v";
483
			}
484
		else
485
			$sql .= "$s_split $param";
486
		$sql = substr($sql, strlen($s_split));
487
488
		return $sql;
489
	} // end of func GenSqlArray
490
491
492
	/**

src/Fwlib/Db/SqlGenerator.php 1 location

@@ 207-222 (lines=16) @@
204
     * @param string    $separator  Should have space included
205
     * @return string
206
     */
207
    protected function genSqlArray($param, $separator = ', ')
208
    {
209
        $sql = '';
210
        if (!empty($param) && is_array($param)) {
211
            // Key of param array is not used
212
            foreach ($param as $v) {
213
                $sql .= "$separator$v";
214
            }
215
        } else {
216
            $sql .= "$separator$param";
217
        }
218
        // Remove heading separator and space
219
        $sql = substr($sql, strlen($separator));
220
221
        return $sql;
222
    }
223
224
225
    /**