EntityDocumentSaver::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Wikibase\Api\Service;
4
5
use Mediawiki\DataModel\Content;
6
use Mediawiki\DataModel\EditInfo;
7
use Mediawiki\DataModel\Revision;
8
use Wikibase\DataModel\Entity\EntityDocument;
9
10
/**
11
 * @access private
12
 *
13
 * @author Addshore
14
 */
15
class EntityDocumentSaver {
16
17
	/**
18
	 * @var RevisionSaver
19
	 */
20
	private $revisionSaver;
21
22
	public function __construct( RevisionSaver $revisionSaver ) {
23
		$this->revisionSaver = $revisionSaver;
24
	}
25
26
	/**
27
	 * @since 0.7
28
	 *
29
	 * @param EntityDocument $entityDocument
30
	 * @param EditInfo $editInfo
31
	 *
32
	 * @return EntityDocument
33
	 */
34
	public function save( EntityDocument $entityDocument, EditInfo $editInfo ) {
35
		return $this->revisionSaver->save( new Revision( new Content( $entityDocument ) ), $editInfo );
36
	}
37
38
}
39