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

RedirectCreator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Addwiki\Wikibase\Api\Service;
4
5
use Addwiki\Mediawiki\DataModel\EditInfo;
6
use Addwiki\Wikibase\Api\WikibaseApi;
7
use Wikibase\DataModel\Entity\EntityId;
8
9
/**
10
 * @access private
11
 *
12
 * @author Addshore
13
 */
14
class RedirectCreator {
15
16
	private WikibaseApi $api;
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...
17
18
	/**
19
	 * @param WikibaseApi $api
20
	 */
21
	public function __construct( WikibaseApi $api ) {
22
		$this->api = $api;
23
	}
24
25
	/**
26
	 * @param EntityId $from
27
	 * @param EntityId $to
28
	 * @param EditInfo|null $editInfo
29
	 */
30
	public function create( EntityId $from, EntityId $to, EditInfo $editInfo = null ): bool {
31
		$params = [
32
			'from' => $from->__toString(),
33
			'to' => $to->__toString(),
34
		];
35
36
		$this->api->postRequest( 'wbcreateredirect', $params, $editInfo );
37
		return true;
38
	}
39
40
}
41