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

ListView::processTplName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Records list view file.
4
 *
5
 * @package View
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
 * @author    Radosław Skrzypczak <[email protected]>
11
 */
12
13
namespace YF\Modules\Base\View;
14
15
/**
16
 * Records list view class.
17
 */
18
class ListView extends \App\Controller\View
19
{
20
	/** @var \YF\Modules\Base\Model\ListView List view model. */
21
	protected $listViewModel;
22
23
	/** {@inheritdoc} */
24
	public function process()
25
	{
26
		$this->getListViewModel()->loadRecordsList();
27
		$moduleName = $this->request->getModule();
28
		$this->viewer->assign('HEADERS', $this->listViewModel->getHeaders());
29
		$this->viewer->assign('RECORDS', $this->listViewModel->getRecordsListModel());
30
		$this->viewer->assign('COUNT', $this->listViewModel->getCount());
31
		$this->viewer->assign('PAGE_NUMBER', 11);
32
		$this->viewer->assign('LIST_VIEW_MODEL', $this->listViewModel);
33
		$this->viewer->view('List/ListView.tpl', $moduleName);
34
	}
35
36
	/**
37
	 * Get list view model.
38
	 *
39
	 * @return \YF\Modules\Base\Model\ListView
40
	 */
41 View Code Duplication
	protected function getListViewModel(): \YF\Modules\Base\Model\ListView
0 ignored issues
show
Duplication introduced by
This method 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...
42
	{
43
		if (empty($this->listViewModel)) {
44
			$this->listViewModel = \YF\Modules\Base\Model\ListView::getInstance($this->moduleName, $this->request->getAction());
0 ignored issues
show
Documentation Bug introduced by
It seems like \YF\Modules\Base\Model\L...->request->getAction()) of type object<self> is incompatible with the declared type object<YF\Modules\Base\Model\ListView> of property $listViewModel.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
		}
46
		return $this->listViewModel;
47
	}
48
}
49