Passed
Branch 0.3.0 (b16461)
by Anton
03:42
created

View   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A items() 0 4 1
A itemsCount() 0 4 1
A children() 0 4 1
A childrenCount() 0 4 1
A subtree() 0 4 1
A subtreeCount() 0 4 1
A subtreeDepth() 0 4 1
A path() 0 4 1
1
<?php
2
3
namespace Modules\Entitizer\Utils\Entity {
4
5
	use Modules\Entitizer;
6
7
	trait View {
8
9
		protected $definition = null, $error = false, $modifiable = false, $data = [];
10
11
		# Get items
12
13
		public function items(array $config = [], array $order_by = [], int $index = 0, int $display = 0) {
14
15
			return Entitizer::listview(static::$table)->items($config, $order_by, $index, $display);
16
		}
17
18
		# Get items count
19
20
		public function itemsCount(array $config = []) {
21
22
			return Entitizer::listview(static::$table)->itemsCount($config);
23
		}
24
25
		# Get children
26
27
		public function children(array $config = [], array $order_by = [], int $index = 0, int $display = 0) {
28
29
			return Entitizer::listview(static::$table)->children($this->id, $config, $order_by, $index, $display);
0 ignored issues
show
Bug introduced by
The property id 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...
30
		}
31
32
		# Get children count
33
34
		public function childrenCount(array $config = []) {
35
36
			return Entitizer::listview(static::$table)->childrenCount($this->id, $config);
37
		}
38
39
		# Get subtree
40
41
		public function subtree(array $config = [], array $order_by = []) {
42
43
			return Entitizer::treeview(static::$table)->subtree($this->id, $config, $order_by);
44
		}
45
46
		# Get subtree count
47
48
		public function subtreeCount() {
49
50
			return Entitizer::treeview(static::$table)->subtreeCount($this->id);
51
		}
52
53
		# Get subtree depth
54
55
		public function subtreeDepth() {
56
57
			return Entitizer::treeview(static::$table)->subtreeDepth($this->id);
58
		}
59
60
		# Get path
61
62
		public function path() {
63
64
			return Entitizer::treeview(static::$table)->path($this->id);
65
		}
66
	}
67
}
68