Completed
Push — main ( b55b92...e8d442 )
by
unknown
05:41
created

EntityDocumentSaver   A

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
1
<?php
2
3
namespace Addwiki\Wikibase\Api\Service;
4
5
use Addwiki\Mediawiki\DataModel\Content;
6
use Addwiki\Mediawiki\DataModel\EditInfo;
7
use Addwiki\Mediawiki\DataModel\Revision;
8
use Wikibase\DataModel\Entity\EntityDocument;
9
use Wikibase\DataModel\Entity\Item;
10
use Wikibase\DataModel\Entity\Property;
11
12
/**
13
 * @access private
14
 *
15
 * @author Addshore
16
 */
17
class EntityDocumentSaver {
18
19
	private RevisionSaver $revisionSaver;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
20
21
	public function __construct( RevisionSaver $revisionSaver ) {
22
		$this->revisionSaver = $revisionSaver;
23
	}
24
25
	/**
26
	 * @since 0.7
27
	 *
28
	 * @param EntityDocument $entityDocument
29
	 * @param EditInfo $editInfo
30
	 *
31
	 * @return Item|Property
32
	 */
33
	public function save( EntityDocument $entityDocument, EditInfo $editInfo ) {
34
		return $this->revisionSaver->save( new Revision( new Content( $entityDocument ) ), $editInfo );
35
	}
36
37
}
38