Completed
Push — master ( c2be12...4adc53 )
by adam
02:59
created

EntityDocumentSaver::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
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
	 * @param EntityDocument $entityDocument
28
	 * @param EditInfo $editInfo
29
	 *
30
	 * @return EntityDocument
31
	 */
32
	public function save( EntityDocument $entityDocument, EditInfo $editInfo ) {
33
		return $this->revisionSaver->save( new Revision( new Content( $entityDocument ) ), $editInfo );
34
	}
35
36
}
37