EntityDocumentSaver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

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
	 * @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