Passed
Push — 0.3.0 ( 0d73f1...9a02d7 )
by Anton
04:10
created

Users::init()   B

Complexity

Conditions 6
Paths 1

Size

Total Lines 27
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
rs 8.439
cc 6
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace Modules\Entitizer\Collection {
4
5
	use Modules\Entitizer;
6
7
	trait Users {
8
9
		protected static $order_by = ['rank' => 'DESC', 'name' => 'ASC', 'id' => 'ASC'];
10
11
		# Init collection
12
13
		protected function init() {
14
15
			$this->config->add('rank', null, 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...
16
17
				return ((null !== $rank) ? ("ent.rank >= " . $rank) : '');
18
			});
19
20
			$this->config->add('time_registered >=', 0, function (int $time) {
21
22
				return ((0 < $time) ? ("ent.time_registered >= " . $time) : '');
23
			});
24
25
			$this->config->add('time_registered <=', 0, function (int $time) {
26
27
				return ((0 < $time) ? ("ent.time_registered <= " . $time) : '');
28
			});
29
30
			$this->config->add('time_logged >=', 0, function (int $time) {
31
32
				return ((0 < $time) ? ("ent.time_logged >= " . $time) : '');
33
			});
34
35
			$this->config->add('time_logged <=', 0, function (int $time) {
36
37
				return ((0 < $time) ? ("ent.time_logged <= " . $time) : '');
38
			});
39
		}
40
	}
41
}
42