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

EntityDocumentSaver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A save() 0 3 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
	 * @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