Code Duplication    Length = 13-14 lines in 2 locations

src/controller/ApiManagerController.php 2 locations

@@ 83-95 (lines=13) @@
80
            $workflow = $this->getWorkflow($model);
81
            $statesFrom = $this->getState($fromState);
82
      			$statesTo = $this->getState($toState);
83
      			if($workflow->count() == 0){
84
      				Session::flash('message', 'Error 101 #error workflow not found');
85
      				return Redirect::to('api-manager');
86
      			}elseif($statesTo->count() == 0 || $statesFrom->count() == 0){
87
      				Session::flash('message', 'Error 102 #error state not active or state not found');
88
      				return Redirect::to('api-manager');
89
      			}else{
90
      				$api->save();
91
      				$this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first());
92
93
      				Session::flash('message', 'Api Keys Data Saved Successfuly');
94
      				return Redirect::to('api-manager');
95
      			}
96
        } catch (Exception $e) {
97
            Session::flash('message', 'Error 404 #error not found');
98
            return Redirect::to('api-manager');
@@ 488-501 (lines=14) @@
485
                  $workflow = $this->getWorkflow($model);
486
                  $statesFrom = $this->getState($fromState);
487
            			$statesTo = $this->getState($toState);
488
            			if($workflow->count() == 0){
489
            				Session::flash('message', 'Error 101 #error workflow not found');
490
            				return Redirect::to('api-manager');
491
            			}
492
                  elseif($statesTo->count() == 0 || $statesFrom->count() == 0){
493
            				Session::flash('message', 'Error 102 #error state not active or state not found');
494
            				return Redirect::to('api-manager');
495
            			}
496
                  else{
497
              				$this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first());
498
499
              				Session::flash('message', 'Api Keys Data Saved Successfuly. Your request has already been send.');
500
              				return Redirect::to('api-manager');
501
            			}
502
                }
503
                else{
504
                    Session::flash('message', 'Error 404 #error not found');