X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FStateMachine.php;h=91c92a3ad83ad01029a24d234f265882365b5870;hb=13f4925aff54e7453b4ed38cd882349aae2e4623;hp=b97c978901b9f9d1be13e8f71350c76e4f602d87;hpb=771e2548641c460d0f7a244ad0aefb05c703b478;p=civicrm-core.git diff --git a/CRM/Core/StateMachine.php b/CRM/Core/StateMachine.php index b97c978901..91c92a3ad8 100644 --- a/CRM/Core/StateMachine.php +++ b/CRM/Core/StateMachine.php @@ -1,7 +1,7 @@ _controller = &$controller; $this->_action = $action; @@ -100,40 +100,42 @@ class CRM_Core_StateMachine { } /** - * Getter for name + * Getter for name. * * @return string - * @access public */ public function getName() { return $this->_name; } /** - * Setter for name + * Setter for name. * - * @param string + * @param string $name * * @return void - * @access public */ public function setName($name) { $this->_name = $name; } /** - * Do a state transition jump. Currently only supported types are + * Do a state transition jump. + * + * Currently only supported types are * Next and Back. The other actions (Cancel, Done, Submit etc) do * not need the state machine to figure out where to go * - * @param CRM_Core_Form $page the current form-page - * @param string $actionName Current action name, as one Action object can serve multiple actions - * @param string $type The type of transition being requested (Next or Back) + * @param CRM_Core_Form $page + * The current form-page. + * @param string $actionName + * Current action name, as one Action object can serve multiple actions. + * @param string $type + * The type of transition being requested (Next or Back). * * @return void - * @access public */ - function perform(&$page, $actionName, $type = 'Next') { + public function perform(&$page, $actionName, $type = 'Next') { // save the form values and validation status to the session $page->isFormBuilt() or $page->buildForm(); @@ -171,29 +173,33 @@ class CRM_Core_StateMachine { } /** - * Helper function to add a State to the state machine + * Helper function to add a State to the state machine. * - * @param string $name the internal name - * @param int $type the type of state (START|FINISH|SIMPLE) - * @param object $prev the previous page if any - * @param object $next the next page if any + * @param string $name + * The internal name. + * @param int $type + * The type of state (START|FINISH|SIMPLE). + * @param object $prev + * The previous page if any. + * @param object $next + * The next page if any. * * @return void - * @access public */ - function addState($name, $type, $prev, $next) { + public function addState($name, $type, $prev, $next) { $this->_states[$name] = new CRM_Core_State($name, $type, $prev, $next, $this); } /** - * Given a name find the corresponding state + * Given a name find the corresponding state. * - * @param string $name the state name + * @param string $name + * The state name. * - * @return object the state object - * @access public + * @return object + * the state object */ - function find($name) { + public function find($name) { if (array_key_exists($name, $this->_states)) { return $this->_states[$name]; } @@ -203,67 +209,62 @@ class CRM_Core_StateMachine { } /** - * Return the list of state objects + * Return the list of state objects. * - * @return array array of states in the state machine - * @access public + * @return array + * array of states in the state machine */ - function getStates() { + public function getStates() { return $this->_states; } /** - * Return the state object corresponding to the name + * Return the state object corresponding to the name. * - * @param string $name name of page + * @param string $name + * Name of page. * - * @return CRM_Core_State state object matching the name - * @access public + * @return CRM_Core_State + * state object matching the name */ - function &getState($name) { + public function &getState($name) { if (isset($this->_states[$name])) { - return $this->_states[$name]; - } + return $this->_states[$name]; + } /* * This is a gross hack for ajax driven requests where * we change the form name to allow multiple edits to happen * We need a cleaner way of doing this going forward */ - foreach ($this->_states as $n => $s ) { + foreach ($this->_states as $n => $s) { if (substr($name, 0, strlen($n)) == $n) { return $s; } } - return null; + return NULL; } /** - * Return the list of form objects + * Return the list of form objects. * - * @return array array of pages in the state machine - * @access public + * @return array + * array of pages in the state machine */ - function getPages() { + public function getPages() { return $this->_pages; } /** - * AddSequentialStates: meta level function to create a simple - * wizard for a state machine that is completely sequential. - * - * @access public + * Add sequential pages. * - * @param array $pages (reference ) the array of page objects + * Meta level function to create a simple wizard for a state machine that is completely sequential. * - * @internal param array $states states is an array of arrays. Each element - * of the top level array describes a state. Each state description - * includes the name, the display name and the class name - * - * @return void + * @param array $pages + * (reference ) the array of page objects. */ - function addSequentialPages(&$pages) { + public function addSequentialPages(&$pages) { $this->_pages = &$pages; $numPages = count($pages); @@ -316,72 +317,69 @@ class CRM_Core_StateMachine { } /** - * Reset the state machine + * Reset the state machine. * * @return void - * @access public */ - function reset() { + public function reset() { $this->_controller->reset(); } /** - * Getter for action + * Getter for action. * * @return int - * @access public */ - function getAction() { + public function getAction() { return $this->_action; } /** - * Setter for content + * Setter for content. * - * @param string $content the content generated by this state machine + * @param string $content + * The content generated by this state machine. * * @return void - * @access public */ - function setContent(&$content) { + public function setContent(&$content) { $this->_controller->setContent($content); } /** - * Getter for content + * Getter for content. * * @return string - * @access public */ - function &getContent() { + public function &getContent() { return $this->_controller->getContent(); } /** * @return mixed */ - function getDestination() { + public function getDestination() { return $this->_controller->getDestination(); } /** * @return mixed */ - function getSkipRedirection() { + public function getSkipRedirection() { return $this->_controller->getSkipRedirection(); } /** * @return mixed */ - function fini() { + public function fini() { return $this->_controller->fini(); } /** * @return mixed */ - function cancelAction() { + public function cancelAction() { return $this->_controller->cancelAction(); } @@ -392,11 +390,10 @@ class CRM_Core_StateMachine { * beginning from the final state, but retain the same session * values * - * @return boolean + * @return bool */ - function shouldReset() { + public function shouldReset() { return TRUE; -} + } } -