Code Duplication    Length = 6-7 lines in 4 locations

src/controller/ApiManagerController.php 3 locations

@@ 281-287 (lines=7) @@
278
            else{
279
        		$api->save();
280
        		$this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first(), $user_id);
281
                if(env('URL_APIMANAGER') != NULL){
282
                  $url_apimanager = str_replace('"', '',env('URL_APIMANAGER'));
283
                  if($url_apimanager != "" || $url_apimanager != NULL || $url_apimanager != false || !empty($url_apimanager)){
284
                    $transition = "Propose to Propose";
285
                    $this->send_apimanager($url_apimanager,$client,$host,$transition,$api->api_key);
286
                  }
287
                }
288
                if($requests == 'Request'){
289
                  $model = "ApiKeys";
290
                  $fromState = "propose";
@@ 519-525 (lines=7) @@
516
            else{
517
        		$api->save();
518
        		$this->saveHistory($api, $workflow->first(), $statesFrom->first(), $statesTo->first());
519
                if(env('URL_APIMANAGER') != NULL){
520
                  $url_apimanager = str_replace('"', '',env('URL_APIMANAGER'));
521
                  if($url_apimanager != "" || $url_apimanager != NULL || $url_apimanager != false || !empty($url_apimanager)){
522
                    $transition = "Propose to Propose";
523
                    $this->send_apimanager($url_apimanager,$client,$host,$transition,$api->api_key);
524
                  }
525
                }
526
                if($requests == 'Request'){
527
                  $model = "ApiKeys";
528
                  $fromState = "propose";
@@ 621-626 (lines=6) @@
618
              $result = $request->all();
619
            }
620
            $this->SendClient($client, $host, $error, $statusCode, $title, $type, $message, $result, $state, $transition);
621
            if(env('URL_APIMANAGER') != NULL){
622
              $url_apimanager = str_replace('"', '',env('URL_APIMANAGER'));
623
              if($url_apimanager != "" || $url_apimanager != NULL || $url_apimanager != false || !empty($url_apimanager)){
624
                $this->send_apimanager($url_apimanager,$client,$host,$transition,$get->api_key);
625
              }
626
            }
627
            return Redirect::to('api-manager');
628
          }
629
      } catch (Exception $e) {

src/controller/HostkeysController.php 1 location

@@ 225-230 (lines=6) @@
222
		$hostkey->transition 	= "Propose To ".$responses->result->request;
223
		$hostkey->user_id       = $responses->result->user_id;
224
        $hostkey->save();
225
        if(env('URL_APIMANAGER') != NULL){
226
          $url_apimanager = str_replace('"', '',env('URL_APIMANAGER'));
227
          if($url_apimanager != "" || $url_apimanager != NULL || $url_apimanager != false || !empty($url_apimanager)){
228
            $this->send_apimanager($url_apimanager,$request,$current_user,$hostkey->transition);
229
          }
230
        }
231
        Session::flash('message', 'Send Request Api Keys Successfuly');
232
      }else {
233
        Session::flash('message', $responses->message);