@@ -186,7 +186,7 @@ public function check_redirect_uri( $uri ) {
186186 }
187187
188188 // Check all components except query and fragment
189- $ parts = array ( 'scheme ' , 'host ' , 'port ' , 'user ' , 'pass ' , 'path ' ) ;
189+ $ parts = [ 'scheme ' , 'host ' , 'port ' , 'user ' , 'pass ' , 'path ' ] ;
190190 $ valid = true ;
191191 foreach ( $ parts as $ part ) {
192192 if ( isset ( $ registered [ $ part ] ) !== isset ( $ supplied [ $ part ] ) ) {
@@ -279,18 +279,18 @@ public function issue_token( WP_User $user ) {
279279 * @return static|null Token if ID is found, null otherwise.
280280 */
281281 public static function get_by_id ( $ id ) {
282- $ args = array (
282+ $ args = [
283283 'post_type ' => static ::POST_TYPE ,
284284 'post_status ' => 'publish ' ,
285285 'posts_per_page ' => 1 ,
286286 'no_found_rows ' => true ,
287- 'meta_query ' => array (
288- array (
287+ 'meta_query ' => [
288+ [
289289 'key ' => static ::CLIENT_ID_KEY ,
290290 'value ' => $ id ,
291- ) ,
292- ) ,
293- ) ;
291+ ] ,
292+ ] ,
293+ ] ;
294294 $ query = new WP_Query ( $ args );
295295 if ( empty ( $ query ->posts ) ) {
296296 return null ;
@@ -322,25 +322,25 @@ public static function get_by_post_id( $id ) {
322322 * @return WP_Error|Client Client instance on success, error otherwise.
323323 */
324324 public static function create ( $ data ) {
325- $ post_data = array (
325+ $ post_data = [
326326 'post_type ' => static ::POST_TYPE ,
327327 'post_title ' => $ data ['name ' ],
328328 'post_content ' => $ data ['description ' ],
329329 'post_status ' => 'draft ' ,
330- ) ;
330+ ] ;
331331
332332 $ post_id = wp_insert_post ( wp_slash ( $ post_data ), true );
333333 if ( is_wp_error ( $ post_id ) ) {
334334 return $ post_id ;
335335 }
336336
337337 // Generate ID and secret.
338- $ meta = array (
338+ $ meta = [
339339 static ::REDIRECT_URI_KEY => $ data ['meta ' ]['callback ' ],
340340 static ::TYPE_KEY => $ data ['meta ' ]['type ' ],
341341 static ::CLIENT_ID_KEY => wp_generate_password ( static ::CLIENT_ID_LENGTH , false ),
342342 static ::CLIENT_SECRET_KEY => wp_generate_password ( static ::CLIENT_SECRET_LENGTH , false ),
343- ) ;
343+ ] ;
344344
345345 foreach ( $ meta as $ key => $ value ) {
346346 $ result = update_post_meta ( $ post_id , wp_slash ( $ key ), wp_slash ( $ value ) );
@@ -361,22 +361,22 @@ public static function create( $data ) {
361361 * @return WP_Error|Client Client instance on success, error otherwise.
362362 */
363363 public function update ( $ data ) {
364- $ post_data = array (
364+ $ post_data = [
365365 'ID ' => $ this ->get_post_id (),
366366 'post_type ' => static ::POST_TYPE ,
367367 'post_title ' => $ data ['name ' ],
368368 'post_content ' => $ data ['description ' ],
369- ) ;
369+ ] ;
370370
371371 $ post_id = wp_update_post ( wp_slash ( $ post_data ), true );
372372 if ( is_wp_error ( $ post_id ) ) {
373373 return $ post_id ;
374374 }
375375
376- $ meta = array (
376+ $ meta = [
377377 static ::REDIRECT_URI_KEY => $ data ['meta ' ]['callback ' ],
378378 static ::TYPE_KEY => $ data ['meta ' ]['type ' ],
379- ) ;
379+ ] ;
380380
381381 foreach ( $ meta as $ key => $ value ) {
382382 update_post_meta ( $ post_id , wp_slash ( $ key ), wp_slash ( $ value ) );
@@ -402,10 +402,10 @@ public function delete() {
402402 * @return bool|WP_Error True if client was updated, error otherwise.
403403 */
404404 public function approve () {
405- $ data = array (
405+ $ data = [
406406 'ID ' => $ this ->get_post_id (),
407407 'post_status ' => 'publish ' ,
408- ) ;
408+ ] ;
409409 $ result = wp_update_post ( wp_slash ( $ data ), true );
410410 return is_wp_error ( $ result ) ? $ result : true ;
411411 }
@@ -414,25 +414,25 @@ public function approve() {
414414 * Register the underlying post type.
415415 */
416416 public static function register_type () {
417- register_post_type ( static ::POST_TYPE , array (
417+ register_post_type ( static ::POST_TYPE , [
418418 'public ' => false ,
419419 'hierarchical ' => true ,
420- 'capability_type ' => array (
420+ 'capability_type ' => [
421421 'oauth2_client ' ,
422422 'oauth2_clients ' ,
423- ) ,
424- 'capabilities ' => array (
423+ ] ,
424+ 'capabilities ' => [
425425 'edit_posts ' => 'edit_users ' ,
426426 'edit_others_posts ' => 'edit_users ' ,
427427 'publish_posts ' => 'edit_users ' ,
428- ) ,
429- 'supports ' => array (
428+ ] ,
429+ 'supports ' => [
430430 'title ' ,
431431 'editor ' ,
432432 'revisions ' ,
433433 'author ' ,
434434 'thumbnail ' ,
435- ) ,
436- ) );
435+ ] ,
436+ ] );
437437 }
438438}
0 commit comments