@@ -93,7 +93,7 @@ function() use ( $t_app, $t_plugin ) {
93
93
*/
94
94
public function route_token_revoke ( $ p_request , $ p_response , $ p_args ) {
95
95
# Make sure the given repository exists
96
- $ t_repo_id = isset ( $ p_args ['id ' ] ) ? $ p_args [ ' id ' ] : $ p_request ->getParam ( 'id ' );
96
+ $ t_repo_id = $ p_args ['id ' ] ?? $ p_request ->getParam ('id ' );
97
97
if ( !SourceRepo::exists ( $ t_repo_id ) ) {
98
98
return $ p_response ->withStatus ( HTTP_STATUS_BAD_REQUEST , 'Invalid Repository Id ' );
99
99
}
@@ -126,7 +126,7 @@ public function route_webhook( $p_request, $p_response, $p_args ) {
126
126
plugin_push_current ( 'Source ' );
127
127
128
128
# Make sure the given repository exists
129
- $ t_repo_id = isset ( $ p_args ['id ' ] ) ? $ p_args [ ' id ' ] : $ p_request ->getParam ( 'id ' );
129
+ $ t_repo_id = $ p_args ['id ' ] ?? $ p_request ->getParam ('id ' );
130
130
if ( !SourceRepo::exists ( $ t_repo_id ) ) {
131
131
return $ p_response ->withStatus ( HTTP_STATUS_BAD_REQUEST , 'Invalid Repository Id ' );
132
132
}
@@ -287,11 +287,7 @@ public function update_repo_form( $p_repo ) {
287
287
$ t_hub_webhook_secret = $ p_repo ->info ['hub_webhook_secret ' ];
288
288
}
289
289
290
- if ( isset ( $ p_repo ->info ['master_branch ' ] ) ) {
291
- $ t_master_branch = $ p_repo ->info ['master_branch ' ];
292
- } else {
293
- $ t_master_branch = $ this ->get_default_primary_branches ();
294
- }
290
+ $ t_master_branch = $ p_repo ->info ['master_branch ' ] ?? $ this ->get_default_primary_branches ();
295
291
?>
296
292
297
293
<tr>
@@ -462,6 +458,8 @@ public function update_repo( $p_repo ) {
462
458
*
463
459
* @param SourceRepo $p_repo Repository
464
460
* @return \GuzzleHttp\Client
461
+ *
462
+ * @noinspection PhpReturnValueOfMethodIsNeverUsedInspection
465
463
*/
466
464
private function api_init ( $ p_repo ) {
467
465
# Initialize Guzzle client if not done already
@@ -538,7 +536,8 @@ private function api_get( $p_repo, $p_path, $p_member = '' ) {
538
536
}
539
537
}
540
538
541
- private function api_json_url ( $ p_repo , $ p_url , $ p_member = null ) {
539
+ /** @noinspection PhpSameParameterValueInspection */
540
+ private function api_json_url ($ p_repo , $ p_url , $ p_member = null ) {
542
541
static $ t_start_time ;
543
542
if ( $ t_start_time === null ) {
544
543
$ t_start_time = microtime ( true );
@@ -561,12 +560,11 @@ private function api_json_url( $p_repo, $p_url, $p_member = null ) {
561
560
562
561
public function precommit () {
563
562
# Legacy GitHub Service sends the payload via eponymous form variable
564
- /** @noinspection PhpRedundantOptionalArgumentInspection */
565
563
$ f_payload = gpc_get_string ( 'payload ' , null );
566
564
if ( is_null ( $ f_payload ) ) {
567
565
# If empty, retrieve the webhook's payload from the body
568
566
$ f_payload = file_get_contents ( 'php://input ' );
569
- if ( is_null ( $ f_payload ) ) {
567
+ if ( $ f_payload === false ) {
570
568
return null ;
571
569
}
572
570
}
@@ -684,10 +682,10 @@ public function import_full( $p_repo ) {
684
682
$ t_changeset_table = plugin_table ( 'changeset ' , 'Source ' );
685
683
686
684
foreach ( $ t_branches as $ t_branch ) {
687
- /** @noinspection SqlResolve */
685
+ /** @noinspection SqlResolve DuplicatedCode */
688
686
$ t_query = "SELECT parent FROM $ t_changeset_table
689
687
WHERE repo_id= " . db_param () . ' AND branch= ' . db_param () .
690
- ' ORDER BY timestamp ASC ' ;
688
+ ' ORDER BY timestamp ' ;
691
689
$ t_result = db_query ( $ t_query , array ( $ p_repo ->id , $ t_branch ), 1 );
692
690
693
691
$ t_commits = array ( $ t_branch );
@@ -817,7 +815,6 @@ private function json_commit_changeset( $p_repo, $p_json, $p_branch='' ) {
817
815
private function oauth_authorize_uri ( $ p_repo ) {
818
816
$ t_hub_app_client_id = null ;
819
817
$ t_hub_app_secret = null ;
820
- $ t_hub_app_access_token = null ;
821
818
822
819
if ( isset ( $ p_repo ->info ['hub_app_client_id ' ] ) ) {
823
820
$ t_hub_app_client_id = $ p_repo ->info ['hub_app_client_id ' ];
0 commit comments