Completed
Push — master ( e581ca...436d2e )
by Daniel
08:58
created

options   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 61.11%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 54
ccs 11
cts 18
cp 0.6111
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A get_all() 0 12 2
A get_topic_types() 0 9 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\services\forum;
11
12
class options
13
{
14
	/**
15
	 * Constructor
16
	 *
17
	 * @param string		$phpbb_root_path	Path to the phpbb includes directory.
18
	 * @param string		$php_ext			php file extension
19
	 */
20 1
	public function __construct($phpbb_root_path, $php_ext)
21
	{
22 1
		if (!function_exists('make_forum_select'))
23 1
		{
24
			include($phpbb_root_path . 'includes/functions_admin.' . $php_ext); // @codeCoverageIgnore
25
		}
26 1
	}
27
28
	/**
29
	 * @param bool $select_id
30
	 * @param bool $ignore_id
31
	 * @param bool $ignore_acl
32
	 * @param bool $ignore_nonpost
33
	 * @param bool $ignore_emptycat
34
	 * @param bool $only_acl_post
35
	 * @return array
36
	 */
37 1
	public function get_all($select_id = false, $ignore_id = false, $ignore_acl = true, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false)
38
	{
39 1
		$forumlist = make_forum_select($select_id, $ignore_id, $ignore_acl, $ignore_nonpost, $ignore_emptycat, $only_acl_post, true);
40
41 1
		$forum_options = array('' => 'ALL');
42 1
		foreach ($forumlist as $row)
43
		{
44 1
			$forum_options[$row['forum_id']] = $row['padding'] . $row['forum_name'];
45 1
		}
46
47 1
		return $forum_options;
48
	}
49
50
	/**
51
	 * Get array of topic types. 
52
	 * This is used primarily by blocks config and the values are translated automatically
53
	 *
54
	 * @return array
55
	 */
56
	public function get_topic_types()
57
	{
58
		return array(
59
			POST_NORMAL     => 'POST_NORMAL',
60
			POST_STICKY     => 'POST_STICKY',
61
			POST_ANNOUNCE   => 'POST_ANNOUNCEMENT',
62
			POST_GLOBAL     => 'POST_GLOBAL',
63
		);
64
	}
65
}
66