1 | <?php |
||
14 | class RedirectCreator { |
||
15 | |||
16 | private WikibaseApi $api; |
||
|
|||
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 |