Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:02
created

TWizardNavigationTemplate::instantiateIn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * TWizard and the relevant class definitions.
4
 *
5
 * @author Qiang Xue <[email protected]>
6
 * @link https://github.com/pradosoft/prado
7
 * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
9
 * @package Prado\Web\UI\WebControls
10
 */
11
12
namespace Prado\Web\UI\WebControls;
13
14
use Prado\Exceptions\TInvalidDataValueException;
15
use Prado\Web\UI\ITemplate;
16
17
/**
18
 * TWizardNavigationTemplate class.
19
 * TWizardNavigationTemplate is the base class for various navigation templates.
20
 * @author Qiang Xue <[email protected]>
21
 * @package Prado\Web\UI\WebControls
22
 * @since 3.0
23
 */
24
class TWizardNavigationTemplate extends \Prado\TComponent implements ITemplate
25
{
26
	private $_wizard;
27
28
	/**
29
	 * Constructor.
30
	 * @param TWizard the wizard owning this template
31
	 */
32
	public function __construct($wizard)
33
	{
34
		$this->_wizard = $wizard;
35
	}
36
37
	/**
38
	 * @return TWizard the wizard owning this template
39
	 */
40
	public function getWizard()
41
	{
42
		return $this->_wizard;
43
	}
44
45
	/**
46
	 * Instantiates the template.
47
	 * Derived classes should override this method.
48
	 * @param TControl parent to hold the content within the template
0 ignored issues
show
Bug introduced by
The type Prado\Web\UI\WebControls\parent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
	 */
50
	public function instantiateIn($parent)
51
	{
52
	}
53
54
	/**
55
	 * Creates a navigation button.
0 ignored issues
show
Bug introduced by
The type Prado\Web\UI\WebControls\button was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
56
	 * It creates a {@link TButton}, {@link TLinkButton}, or {@link TImageButton},
57
	 * depending on the given parameters.
58
	 * @param TWizardNavigationButtonStyle button style
59
	 * @param boolean whether the button should cause validation
0 ignored issues
show
Bug introduced by
The type Prado\Web\UI\WebControls\whether was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
60
	 * @param string command name for the button's OnCommand event
0 ignored issues
show
Bug introduced by
The type Prado\Web\UI\WebControls\command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
61
	 * @throws TInvalidDataValueException if the button type is not recognized
62
	 */
63
	protected function createNavigationButton($buttonStyle, $causesValidation, $commandName)
64
	{
65
		switch($buttonStyle->getButtonType())
66
		{
67
			case TWizardNavigationButtonType::Button:
68
				$button = new TButton;
69
				break;
70
			case TWizardNavigationButtonType::Link:
71
				$button = new TLinkButton;
72
				break;
73
			case TWizardNavigationButtonType::Image:
74
				$button = new TImageButton;
75
				$button->setImageUrl($buttonStyle->getImageUrl());
76
				break;
77
			default:
78
				throw new TInvalidDataValueException('wizard_buttontype_unknown', $buttonStyle->getButtonType());
79
		}
80
		$button->setText($buttonStyle->getButtonText());
81
		$button->setCausesValidation($causesValidation);
82
		$button->setCommandName($commandName);
83
		return $button;
84
	}
85
}