Code Duplication    Length = 2-2 lines in 5 locations

src/controller/ApiManagerController.php 4 locations

@@ 70-71 (lines=2) @@
67
                  ->withErrors($validator)
68
                  ->withInput();
69
      	}
70
        if(Auth::guest()){ $current_user = 1; }
71
        else{ $current_user = (Auth::user())?((Auth::user()->id)?Auth::user()->id:1):1; }
72
73
        try {
74
            $token 		= $this->token();
@@ 485-486 (lines=2) @@
482
				'message' => $validator->errors()->all()
483
			));
484
    	}
485
      if(Auth::guest()){ $current_user = 1; }
486
      else{ $current_user = (Auth::user())?((Auth::user()->id)?Auth::user()->id:1):1; }
487
488
      try {
489
          $client 			= str_replace(array('https://', 'http://'), array('',''),$request->input('client'));
@@ 636-637 (lines=2) @@
633
    }
634
635
    private function SendClient($client, $host, $error, $statusCode, $title, $type, $message, $result, $state, $transition){
636
        if(Auth::guest()){ $current_user = 1; }
637
        else{ $current_user = (Auth::user())?((Auth::user()->id)?Auth::user()->id:1):1; }
638
        if($state == 'Approved'){
639
          $apikey = $result->api_key;
640
        }else{
@@ 780-781 (lines=2) @@
777
    }
778
779
    private function send_apimanager($url_apimanager,$client,$host,$keterangan,$apikey=""){
780
        if(Auth::guest()){ $current_user = 1; }
781
        else{ $current_user = (Auth::user())?((Auth::user()->id)?Auth::user()->id:1):1; }
782
        $headers = ['Content-Type' => 'application/json'];
783
        $host       = str_replace(array('https://', 'http://'), array('',''),$host);
784
        $client       = str_replace(array('https://', 'http://'), array('',''),$client);

src/controller/HostkeysController.php 1 location

@@ 168-169 (lines=2) @@
165
                ->withErrors($validator)
166
                ->withInput();
167
      }
168
      if(Auth::guest()){ $current_user = 1; }
169
      else{ $current_user = (Auth::user())?((Auth::user()->id)?Auth::user()->id:1):1; }
170
      $headers = ['Content-Type' => 'application/json'];
171
      $data = [
172
        'host' => $request->host,