Completed
Push — master ( db7709...24ebcc )
by Daniel
10:24
created

stats::display()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 9.4286
cc 1
eloc 9
nc 1
nop 2
crap 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\blocks;
11
12
/**
13
* Stats Block
14
*/
15
class stats extends \blitze\sitemaker\services\blocks\driver\block
16
{
17
	/**
18
	* phpBB configuration
19
	* @var \phpbb\config\config
20
	*/
21
	protected $config;
22
23
	/**
24
	* User object
25
	* @var \phpbb\user
26
	*/
27
	protected $user;
28
29
	/**
30
	 * Constructor
31
	 *
32
	 * @param \phpbb\config\config	$config		phpBB configuration
33
	 * @param \phpbb\user			$user       User object
34
	 */
35 2
	public function __construct(\phpbb\config\config $config, \phpbb\user $user)
36
	{
37 2
		$this->config = $config;
38 2
		$this->user = $user;
39 2
	}
40
41
	/**
42
	 * {@inheritdoc}
43
	 */
44 1
	public function display(array $settings, $edit_mode = false)
45
	{
46 1
		$content = '';
47 1
		$content .= $this->user->lang('TOTAL_POSTS_COUNT', (int) $this->config['num_posts']) . '<br />';
48 1
		$content .= $this->user->lang('TOTAL_TOPICS', (int) $this->config['num_topics']) . '<br />';
49 1
		$content .= $this->user->lang('TOTAL_USERS', (int) $this->config['num_users']) . '<br />';
50 1
		$content .= $this->user->lang('NEWEST_USER', get_username_string('full', $this->config['newest_user_id'], $this->config['newest_username'], $this->config['newest_user_colour']));
51
52
		return array(
53 1
			'title'		=> 'STATISTICS',
54 1
			'content'	=> $content,
55 1
		);
56
	}
57
}
58