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');
@@ 470-483 (lines=14) @@
467
                  $workflow = $this->getWorkflow($model);
468
                  $statesFrom = $this->getState($fromState);
469
            			$statesTo = $this->getState($toState);
470
            			if($workflow->count() == 0){
471
            				Session::flash('message', 'Error 101 #error workflow not found');
472
            				return Redirect::to('api-manager');
473
            			}
474
                  elseif($statesTo->count() == 0 || $statesFrom->count() == 0){
475
            				Session::flash('message', 'Error 102 #error state not active or state not found');
476
            				return Redirect::to('api-manager');
477
            			}
478
                  else{
479
              				$this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first());
480
481
              				Session::flash('message', 'Api Keys Data Saved Successfuly. Your request has already been send.');
482
              				return Redirect::to('api-manager');
483
            			}
484
                }
485
                else{
486
                    Session::flash('message', 'Error 404 #error not found');