Completed
Pull Request — master (#95)
by korelstar
05:25
created

Meta::fromNote()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
/**
3
 * Nextcloud - Notes
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 */
8
9
namespace OCA\Notes\Db;
10
11
use OCP\AppFramework\Db\Entity;
12
13
class Meta extends Entity {
14
15
	public $userId;
16
	public $fileId;
17
	public $lastUpdate;
18
	public $etag;
19
20
	/**
21
	 * @param Note $note
22
	 * @return static
23
	 */
24
	public static function fromNote(Note $note, $userId) {
25
		$meta = new static();
26
		$meta->setUserId($userId);
27
		$meta->setFileId($note->getId());
28
		$meta->setLastUpdate(time());
29
		$meta->setEtag($note->getEtag());
30
		return $meta;
31
	}
32
}
33