protected function initializeStates()
    {
        if (!array_key_exists('states', $this->vars)) {
            throw new WorkflowException("You must define some states:\n", 99, NULL);
        }

        //check if all the methods for each status is callable
        $methods_not_implemented = '';
        try {
            foreach ($this->vars['states'] as $status) {
                array_push($this->states, new Status($status));

                /*
                 * The initial state will never be executed but only the transitions, therefore it will be excluded
                 * from the list of methods which must be implemented
                 */
                if (!method_exists($this, $status['name'])
                    && $status['type'] != \Mothership\StateMachine\StatusInterface::TYPE_INITIAL
                    && $status['type'] != \Mothership\StateMachine\StatusInterface::TYPE_EXCEPTION) {
                    $methods_not_implemented .= $status['name'] . "\n";
                }
            }
        } catch (StatusException $ex) {
            throw new WorkflowException("Error in one state of the workflow:\n" . $ex->getMessage(), 79);
        }

        if (strlen($methods_not_implemented) > 0) {
            throw new WorkflowException(
                "This methods are not implemented in the workflow:\n" .
                $methods_not_implemented, 79, NULL
            );
        }
    }
protected function initializeStates()
    {
        if (!array_key_exists('states', $this->vars)) {
            throw new WorkflowException("You must define some states:\n", 99, NULL);
        }

        //check if all the methods for each status is callable
        $methods_not_implemented = '';
        try {
            foreach ($this->vars['states'] as $status) {
                array_push($this->states, new Status($status));

                /*
                 * The initial state will never be executed but only the transitions, therefore it will be excluded
                 * from the list of methods which must be implemented
                 */
                if (!method_exists($this, $status['name'])
                    && $status['type'] != \Mothership\StateMachine\StatusInterface::TYPE_INITIAL
                    && $status['type'] != \Mothership\StateMachine\StatusInterface::TYPE_EXCEPTION) {
                    $methods_not_implemented .= $status['name'] . "\n";
                }
            }
        } catch (StatusException $ex) {
            throw new WorkflowException("Error in one state of the workflow:\n" . $ex->getMessage(), 79);
        }

        if (strlen($methods_not_implemented) > 0) {
            throw new WorkflowException(
                "This methods are not implemented in the workflow:\n" .
                $methods_not_implemented, 79, NULL
            );
        }
    }
protected function initializeStates ( ) { if ( ! array_key_exists ( 'states' , $ this -> vars ) ) { throw new WorkflowException ( "You must define some states:\n" , 99 , NULL ) ; } //check if all the methods for each status is callable $ methods_not_implemented = '' ; try { foreach ( $ this -> vars [ 'states' ] as $ status ) { array_push ( $ this -> states , new Status ( $ status ) ) ; /*
                 * The initial state will never be executed but only the transitions, therefore it will be excluded
                 * from the list of methods which must be implemented
                 */ if ( ! method_exists ( $ this , $ status [ 'name' ] ) && $ status [ 'type' ] != \ Mothership \ StateMachine \ StatusInterface :: TYPE_INITIAL && $ status [ 'type' ] != \ Mothership \ StateMachine \ StatusInterface :: TYPE_EXCEPTION ) { $ methods_not_implemented .= $ status [ 'name' ] . "\n" ; } } } catch ( StatusException $ ex ) { throw new WorkflowException ( "Error in one state of the workflow:\n" . $ ex -> getMessage ( ) , 79 ) ; } if ( strlen ( $ methods_not_implemented ) > 0 ) { throw new WorkflowException ( "This methods are not implemented in the workflow:\n" . $ methods_not_implemented , 79 , NULL ) ; } }
Initialize the states

@throws WorkflowException

@return void
Initialize the states