|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Mediawiki\DataModel; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class representing metadata about a MediaWiki namespace |
|
7
|
|
|
* |
|
8
|
|
|
* @author gbirke |
|
9
|
|
|
*/ |
|
10
|
|
|
class NamespaceInfo |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @var int |
|
14
|
|
|
*/ |
|
15
|
|
|
private $id; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var string |
|
19
|
|
|
*/ |
|
20
|
|
|
private $canonicalName; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var string |
|
24
|
|
|
*/ |
|
25
|
|
|
private $localName; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
private $caseHandling; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
private $defaultContentModel; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* NamespaceInfo constructor. |
|
39
|
|
|
* @param int $id |
|
40
|
|
|
* @param string $canonicalName |
|
41
|
|
|
* @param string $localName |
|
42
|
|
|
* @param string $caseHandling |
|
43
|
|
|
* @param string $defaultContentModel |
|
44
|
|
|
* |
|
45
|
|
|
* @throws InvalidArgumentException |
|
46
|
|
|
*/ |
|
47
|
11 |
|
public function __construct( $id, $canonicalName, $localName, $caseHandling, $defaultContentModel = null ) |
|
48
|
|
|
{ |
|
49
|
11 |
|
if( !is_int( $id ) ) { |
|
50
|
2 |
|
throw new \InvalidArgumentException( '$id must be an integer' ); |
|
51
|
|
|
} |
|
52
|
9 |
|
if ( !is_string( $canonicalName ) ) { |
|
53
|
2 |
|
throw new \InvalidArgumentException( '$canonicalName must be a string' ); |
|
54
|
|
|
} |
|
55
|
7 |
|
if ( !is_string( $localName ) ) { |
|
56
|
1 |
|
throw new \InvalidArgumentException( '$localName must be a string' ); |
|
57
|
|
|
} |
|
58
|
6 |
|
if ( !is_string( $caseHandling ) ) { |
|
59
|
|
|
throw new \InvalidArgumentException( '$caseHandling must be a string' ); |
|
60
|
|
|
} |
|
61
|
6 |
|
if ( !is_null( $defaultContentModel) && !is_string( $defaultContentModel ) ) { |
|
62
|
2 |
|
throw new \InvalidArgumentException( '$canonicalName must be a string' ); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
4 |
|
$this->id = $id; |
|
66
|
4 |
|
$this->canonicalName = $canonicalName; |
|
67
|
4 |
|
$this->localName = $localName; |
|
68
|
4 |
|
$this->caseHandling = $caseHandling; |
|
69
|
4 |
|
$this->defaultContentModel = $defaultContentModel; |
|
70
|
4 |
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return int |
|
74
|
|
|
*/ |
|
75
|
4 |
|
public function getId() |
|
76
|
|
|
{ |
|
77
|
4 |
|
return $this->id; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return string |
|
82
|
|
|
*/ |
|
83
|
4 |
|
public function getCanonicalName() |
|
84
|
|
|
{ |
|
85
|
4 |
|
return $this->canonicalName; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return string |
|
90
|
|
|
*/ |
|
91
|
4 |
|
public function getLocalName() |
|
92
|
|
|
{ |
|
93
|
4 |
|
return $this->localName; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
4 |
|
public function getCaseHandling() |
|
100
|
|
|
{ |
|
101
|
4 |
|
return $this->caseHandling; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
4 |
|
public function getDefaultContentModel() |
|
108
|
|
|
{ |
|
109
|
4 |
|
return $this->defaultContentModel; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
} |