PickUser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A create_options() 0 7 1
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\Element;
13
14
use Brickrouge\Element;
15
16
use Icybee\Binding\Core\PrototypedBindings;
17
18
/**
19
 * An element to pick a user.
20
 */
21
class PickUser extends Element
22
{
23
	use PrototypedBindings;
24
25
	/**
26
	 * The options of the element are created with {@link create_options()}.
27
	 *
28
	 * @inheritdoc
29
	 */
30
	public function __construct(array $attributes = [])
31
	{
32
		parent::__construct('select', $attributes + [
33
34
			Element::OPTIONS => [ null => '' ] + $this->create_options($attributes)
35
36
		]);
37
	}
38
39
	/**
40
	 * Creates element's options.
41
	 *
42
	 * @param array $attributes
43
	 *
44
	 * @return array
45
	 */
46
	protected function create_options(array $attributes)
0 ignored issues
show
Unused Code introduced by
The parameter $attributes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
47
	{
48
		return $this->app->models['users']
49
			->select('uid, username')
50
			->order('username')
51
			->pairs;
52
	}
53
}
54