Skip to content

Commit e9d9a1a

Browse files
committed
Merge pull request #5 from destinydriven/master
Updated callback method signatures, visibility keywords (protected)
2 parents 6f333a2 + 7a2568e commit e9d9a1a

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

Controller/Component/WizardComponent.php

+30-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
1515
*/
1616
class WizardComponent extends Component {
17+
18+
/**
19+
* Controller $controller variable.
20+
*
21+
* @var string
22+
* @access public
23+
*/
24+
public $controller = null;
1725
/**
1826
* The Component will redirect to the "expected step" after a step has been successfully
1927
* completed if autoAdvance is true. If false, the Component will redirect to
@@ -117,57 +125,70 @@ class WizardComponent extends Component {
117125
* @var string
118126
* @access protected
119127
*/
120-
public $_currentStep = null;
128+
protected $_currentStep = null;
121129
/**
122130
* Holds the session key for data storage.
123131
*
124132
* @var string
125133
* @access protected
126134
*/
127-
public $_sessionKey = null;
135+
protected $_sessionKey = null;
128136
/**
129137
* Other session keys used.
130138
*
131139
* @var string
132140
* @access protected
133141
*/
134-
public $_configKey = null;
135-
public $_branchKey = null;
142+
protected $_configKey = null;
143+
protected $_branchKey = null;
136144
/**
137145
* Holds the array based url for redirecting.
138146
*
139147
* @var array
140148
* @access protected
141149
*/
142-
public $_wizardUrl = array();
150+
protected $_wizardUrl = array();
143151
/**
144152
* Other components used.
145153
*
146154
* @var array
147155
* @access public
148156
*/
149157
public $components = array('Session');
158+
159+
/**
160+
* WizardComponent Constructor
161+
*
162+
* @param ComponentCollection $collection A ComponentCollection this component can use to lazy-load its components
163+
* @param array $settings Array of configuration settings
164+
* @access public
165+
*/
166+
public function __construct(ComponentCollection $collection, $settings = array()) {
167+
parent::__construct($collection, $settings);
168+
$this->_set($settings);
169+
}
170+
150171
/**
151172
* Initializes WizardComponent for use in the controller
152173
*
153174
* @param object $controller A reference to the instantiating controller object
154175
* @access public
176+
* @return void
155177
*/
156-
public function initialize($controller, $settings = array()) {
178+
public function initialize(Controller $controller) {
157179
$this->controller = $controller;
158-
$this->_set($settings);
159180

160181
$this->_sessionKey = $this->controller->Session->check('Wizard.complete') ? 'Wizard.complete' : 'Wizard.' . $controller->name;
161182
$this->_configKey = 'Wizard.config';
162183
$this->_branchKey = 'Wizard.branches.' . $controller->name;
163184
}
164185
/**
165186
* Component startup method.
166-
*
187+
* Called after the Controller::beforeFilter() and before the controller action
167188
* @param object $controller A reference to the instantiating controller object
168189
* @access public
169190
*/
170-
public function startup(&$controller) {
191+
public function startup(Controller $controller) {
171192
$this->steps = $this->_parseSteps($this->steps);
172193

173194
$this->config('action', $this->action);

0 commit comments

Comments
 (0)