summaryrefslogtreecommitdiff
path: root/bin/reevotech/vendor/addwiki/mediawiki-datamodel/src/NamespaceInfo.php
blob: 451ec972c73d1b8a77c89ba0e1ba78283a848026 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php

namespace Mediawiki\DataModel;

/**
 * Class representing metadata about a MediaWiki namespace
 *
 * @author gbirke
 */
class NamespaceInfo
{
	/**
	 * @var int
	 */
	private $id;

	/**
	 * @var string
	 */
	private $canonicalName;

	/**
	 * @var string
	 */
	private $localName;

	/**
	 * @var string
	 */
	private $caseHandling;

	/**
	 * @var string
	 */
	private $defaultContentModel;

	/**
	 * @var array
	 */
	private $aliases;

	/**
	 * NamespaceInfo constructor.
	 * @param int $id
	 * @param string $canonicalName
	 * @param string $localName
	 * @param string $caseHandling
	 * @param string $defaultContentModel
	 * @param array $aliases
	 *
	 * @throws InvalidArgumentException
	 */
	public function __construct( $id, $canonicalName, $localName, $caseHandling, $defaultContentModel = null, $aliases = [] )
	{
		if( !is_int( $id ) ) {
			throw new \InvalidArgumentException( '$id must be an integer' );
		}
		if ( !is_string( $canonicalName ) ) {
			throw new \InvalidArgumentException( '$canonicalName must be a string' );
		}
		if ( !is_string( $localName ) ) {
			throw new \InvalidArgumentException( '$localName must be a string' );
		}
		if ( !is_string( $caseHandling ) ) {
			throw new \InvalidArgumentException( '$caseHandling must be a string' );
		}
		if ( !is_null( $defaultContentModel) && !is_string( $defaultContentModel ) ) {
			throw new \InvalidArgumentException( '$canonicalName must be a string' );
		}

		if ( !is_array( $aliases ) ) {
			throw new \InvalidArgumentException( '$aliases must be an array' );
		}

		$this->id = $id;
		$this->canonicalName = $canonicalName;
		$this->localName = $localName;
		$this->caseHandling = $caseHandling;
		$this->defaultContentModel = $defaultContentModel;
		$this->aliases = $aliases;
	}

	/**
	 * @return int
	 */
	public function getId()
	{
		return $this->id;
	}

	/**
	 * @return string
	 */
	public function getCanonicalName()
	{
		return $this->canonicalName;
	}

	/**
	 * @return string
	 */
	public function getLocalName()
	{
		return $this->localName;
	}

	/**
	 * @return string
	 */
	public function getCaseHandling()
	{
		return $this->caseHandling;
	}

	/**
	 * @return string
	 */
	public function getDefaultContentModel()
	{
		return $this->defaultContentModel;
	}

	/**
	 * @return array
	 */
	public function getAliases()
	{
		return $this->aliases;
	}

}