Use switch statements for application flow?
<p>I generally use switch statements to simplify a block of multiple if statements - for example - returning a feedback string to a user based on a multiple choice input. </p>

<p>I also tend to construct classes so that there is one "management" method, to avoid sequential steps or chained method invocation within other methods of the class. I've found this helps to keep methods flexible and focussed - i.e.</p>

<pre><code>class MyClass{

    // this method does nothing more than invoke the relevant method
    // depending on the status following the previous. It's entire purpose
    // is to control application flow
    public function manageFlow($input){
        $status = $this-&gt;stepOne($input);
        if($status == false){
            //exit routine
        }

        $status = $this-&gt;stepTwo($input);
        if($status == false){
            //exit routine
       }
    }

    // this method has several sequential steps implemented direcly within it, 
    // for example to a user logging in
    // it makes it impossible to re-use any of the intermediary steps
    public function tangledFlow($input){
         if($input == 'something){
         //100 lines of code
         }
         //then handing on to the next bit
         if($this-&gt;User-&gt;Authenticated){
         //another 100 lines...
         }
    }
}
</code></pre>

<p>Then it occurred to me that I could use a switch statement to control this kind of sequential execution - so my question is: has anyone used a switch statement for this kind of flow control?</p>
