Passed
Push — developer ( a79ea2...2ba598 )
by Mariusz
229:56 queued 195:01
created

ListView   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 19 2
1
<?php
2
/**
3
 * List view action file.
4
 *
5
 * @package Action
6
 *
7
 * @copyright YetiForce Sp. z o.o.
8
 * @license   YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com)
9
 * @author Mariusz Krzaczkowski <[email protected]>
10
 */
11
12
namespace YF\Modules\Base\Action;
13
14
use App\Purifier;
15
16
/**
17
 * List view action class.
18
 */
19
class ListView extends \App\Controller\Action
20
{
21
	/** {@inheritdoc} */
22
	public function process(): void
23
	{
24
		$moduleName = $this->request->getModule();
0 ignored issues
show
Unused Code introduced by
$moduleName is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
25
		$record = $this->request->getByType('record', Purifier::INTEGER);
0 ignored issues
show
Unused Code introduced by
$record is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
26
		$templates = $this->request->getArray('templates', Purifier::INTEGER);
0 ignored issues
show
Unused Code introduced by
$templates is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
27
28
		$count = $logsCountAll = 0;
29
		$rows = $columns = [];
30
		foreach ($this->request->getArray('columns') as $key => $value) {
31
			$columns[$key] = $value['name'];
32
		}
33
		header('content-type: text/json; charset=UTF-8');
34
		echo \App\Json::encode([
35
			'draw' => $this->request->getInteger('draw'),
36
			'iTotalRecords' => $logsCountAll,
37
			'iTotalDisplayRecords' => $count,
38
			'aaData' => $rows
39
		]);
40
	}
41
}
42