blob: 55b8b607347f2e9633299a08255a7b5fd5189262 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
namespace Mediawiki\DataModel;
use JsonSerializable;
class Redirect implements JsonSerializable {
private $from;
private $to;
public function __construct( Title $from, Title $to ) {
$this->from = $from;
$this->to = $to;
}
/**
* @return Title
*/
public function getFrom() {
return $this->from;
}
/**
* @return Title
*/
public function getTo() {
return $this->to;
}
/**
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
*/
public function jsonSerialize() {
return array(
'from' => $this->from->jsonSerialize(),
'to' => $this->to->jsonSerialize(),
);
}
/**
* @param array $json
*
* @return self
*/
public static function jsonDeserialize( $json ) {
return new self(
Title::jsonDeserialize( $json['from'] ),
Title::jsonDeserialize( $json['to'] )
);
}
}
|