Menuitems::init()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 4
Ratio 57.14 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 1
nop 0
dl 4
loc 7
rs 9.4285
c 0
b 0
f 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 View Code Duplication
	trait Menuitems {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
16
		# Collection configuration
17
18
		protected static $order_by = ['position' => 'ASC', 'id' => 'ASC'];
19
20
		/**
21
		 * Initialize the collection
22
		 */
23
24
		protected function init() {
25
26
			$this->config->addParam('active', '', function (bool $active) {
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 ($active ? "ent.active = 1" : '');
29
			});
30
		}
31
	}
32
}
33