Users::init()   B
last analyzed

Complexity

Conditions 6
Paths 1

Size

Total Lines 27
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 8.439
c 0
b 0
f 0
cc 6
eloc 11
nc 1
nop 0
1
<?php
2
3
/**
4
 * @package Cadmium\System\Modules\Entitizer
5
 * @author Anton Romanov
6
 * @copyright Copyright (c) 2015-2017, Anton Romanov
7
 * @link http://cadmium-cms.com
8
 */
9
10
namespace Modules\Entitizer\Collection {
11
12
	use Modules\Entitizer;
13
14
	trait Users {
15
16
		# Collection configuration
17
18
		protected static $order_by = ['rank' => 'DESC', 'name' => 'ASC', 'id' => 'ASC'];
19
20
		/**
21
		 * Initialize the collection
22
		 */
23
24
		protected function init() {
25
26
			$this->config->addParam('rank', '', function (int $rank = null) {
0 ignored issues
show
Bug introduced by
The property config does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
27
28
				return ((null !== $rank) ? ("ent.rank >= " . $rank) : '');
29
			});
30
31
			$this->config->addParam('time_registered >=', '', function (int $time) {
32
33
				return ((0 < $time) ? ("ent.time_registered >= " . $time) : '');
34
			});
35
36
			$this->config->addParam('time_registered <=', '', function (int $time) {
37
38
				return ((0 < $time) ? ("ent.time_registered <= " . $time) : '');
39
			});
40
41
			$this->config->addParam('time_logged >=', '', function (int $time) {
42
43
				return ((0 < $time) ? ("ent.time_logged >= " . $time) : '');
44
			});
45
46
			$this->config->addParam('time_logged <=', '', function (int $time) {
47
48
				return ((0 < $time) ? ("ent.time_logged <= " . $time) : '');
49
			});
50
		}
51
	}
52
}
53