summaryrefslogtreecommitdiff
blob: de20f6c8a9cc7759eac6f8c963c30c46d7c60e78 (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
<?php
/**
 * Wrapper class for using message group states.
 *
 * @file
 * @author Niklas Laxström
 * @author Siebrand Mazeland
 * @copyright Copyright © 2012-2013 Niklas Laxström
 * @license GPL-2.0-or-later
 */

/**
 * Class for making the use of message group state easier.
 * @since 2012-10-05
 */
class MessageGroupStates {
	const CONDKEY = 'state conditions';

	protected $config;

	public function __construct( array $config = null ) {
		$this->config = $config;
	}

	public function getStates() {
		$conf = $this->config;
		unset( $conf[self::CONDKEY] );

		return $conf;
	}

	public function getConditions() {
		$conf = $this->config;
		if ( isset( $conf[self::CONDKEY] ) ) {
			return $conf[self::CONDKEY];
		} else {
			return [];
		}
	}
}