UsernameColumn   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render_cell() 0 20 2
1
<?php
2
3
/*
4
 * This file is part of the Icybee package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Icybee\Modules\Users\Block\ManageBlock;
13
14
use Brickrouge\Element;
15
use Icybee\Block\ManageBlock\Column;
16
use Icybee\Modules\Users\User;
17
18
/**
19
 * Representation of the `username` column.
20
 */
21
class UsernameColumn extends Column
22
{
23
	/**
24
	 * @param User $record
25
	 *
26
	 * @inheritdoc
27
	 */
28
	public function render_cell($record)
29
	{
30
		$label = $record->username;
31
		$name = $record->name;
32
33
		if ($label != $name)
34
		{
35
			$label .= ' <small>(' . $name . ')</small>';
36
		}
37
38
		return new Element('a', [
39
40
			Element::INNER_HTML => $label,
41
42
			'class' => 'edit',
43
			'href' => $this->app->url_for("admin:{$record->constructor}:edit", $record),
44
			'title' => $this->t('manage.edit')
45
46
		]);
47
	}
48
}
49