Passed
Push — developer ( c475b4...5772fb )
by Mariusz
69:56 queued 34:42
created

Modal::getModalIcon()   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
 * Controller class for views.
4
 *
5
 * @copyright YetiForce Sp. z o.o.
6
 * @license   YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com)
7
 * @author    Tomasz Kur <[email protected]>
8
 */
9
10
namespace App\Controller;
11
12
abstract class Modal extends View
0 ignored issues
show
Coding Style introduced by
Modal does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
13
{
14
	protected function getTitle()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
15
	{
16
		return \App\Language::translateModule($this->request->getModule());
17
	}
18
19
	protected function getModalSize()
20
	{
21
		return 'modal-xl';
22
	}
23
24
	/**
25
	* Modal icon.
26
	*
27
	* @return string
28
	*/
29
	protected function getModalIcon(): string
30
	{
31
		return '';
32
	}
33
34
	public function preProcessAjax()
35
	{
36
		$this->viewer->assign('MODAL_SIZE', $this->getModalSize());
37
		$this->viewer->assign('MODAL_CSS', $this->getModalCss());
38
		$this->viewer->assign('MODAL_JS', $this->getModalJs());
39
		$this->viewer->assign('MODAL_TITLE', $this->getTitle());
40
		$this->viewer->assign('MODAL_ICON', $this->getModalIcon());
41
		$this->viewer->assign('VIEW', $this->request->getAction());
42
		$this->viewer->view('Modal/Header.tpl');
43
	}
44
45
	public function postProcessAjax()
46
	{
47
		$this->viewer->view('Modal/Footer.tpl');
48
	}
49
50
	protected function getModalCss()
51
	{
52
		$cssFileNames = [];
53
		return $this->convertScripts($cssFileNames, 'css');
54
	}
55
56
	/** {@inheritdoc} */
57
	protected function getModalJs()
58
	{
59
		$action = $this->request->getAction();
60
		return $this->convertScripts([
61
			'layouts/' . \App\Viewer::getLayoutName() . "/modules/Base/resources/$action.js",
62
		], 'js');
63
	}
64
}
65