Code Duplication    Length = 14-19 lines in 2 locations

cloudcontrol/library/storage/Repository.php 2 locations

@@ 407-425 (lines=19) @@
404
		return $result;
405
	}
406
407
	public function publishDocumentByPath($path)
408
	{
409
		$db = $this->getContentDbHandle();
410
		$sql = '
411
			INSERT OR REPLACE INTO documents_published 
412
				  (`id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`publicationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
413
		    SELECT `id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,"published" as state,`lastModificationDate`,`creationDate`,' . time() . ' as publicationDate, `lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`
414
		      FROM documents_unpublished
415
		     WHERE `path` = :path
416
		';
417
		$stmt = $db->prepare($sql);
418
		if ($stmt === false) {
419
			$errorInfo = $db->errorInfo();
420
			$errorMsg = $errorInfo[2];
421
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
422
		}
423
		$stmt->bindValue(':path', $path);
424
		$stmt->execute();
425
	}
426
427
	public function unpublishDocumentByPath($path)
428
	{
@@ 427-440 (lines=14) @@
424
		$stmt->execute();
425
	}
426
427
	public function unpublishDocumentByPath($path)
428
	{
429
		$db = $this->getContentDbHandle();
430
		$sql = 'DELETE FROM documents_published
431
					  WHERE `path` = :path';
432
		$stmt = $db->prepare($sql);
433
		if ($stmt === false) {
434
			$errorInfo = $db->errorInfo();
435
			$errorMsg = $errorInfo[2];
436
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
437
		}
438
		$stmt->bindValue(':path', $path);
439
		$stmt->execute();
440
	}
441
442
	/**
443
     * Return the results of the query as array of Documents