Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack: PHPCS src/class-tracking #21583

Merged
merged 2 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/phpcs-srctracking
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: PHPCS


48 changes: 33 additions & 15 deletions projects/plugins/jetpack/src/class-tracking.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<?php
/**
* Tracks class.
*
* @package automattic/jetpack
*/

namespace Automattic\Jetpack\Plugin;

use Automattic\Jetpack\Tracking as Tracks;
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Tracking as Tracks;

/**
* Tracks class.
*/
class Tracking {
/**
* Tracking object.
Expand All @@ -20,6 +29,9 @@ class Tracking {
*/
private $initalized = false;

/**
* Initialization function.
*/
public function init() {
if ( $this->initalized ) {
return;
Expand Down Expand Up @@ -101,7 +113,7 @@ public function jetpack_user_authorized() {
*
* @access public
*
* @param string $action Type of secret (one of 'register', 'authorize', 'publicize').
* @param string $action Type of secret (one of 'register', 'authorize', 'publicize').
* @param \WP_User $user The user object.
*/
public function jetpack_verify_secrets_begin( $action, $user ) {
Expand All @@ -113,7 +125,7 @@ public function jetpack_verify_secrets_begin( $action, $user ) {
*
* @access public
*
* @param string $action Type of secret (one of 'register', 'authorize', 'publicize').
* @param string $action Type of secret (one of 'register', 'authorize', 'publicize').
* @param \WP_User $user The user object.
*/
public function jetpack_verify_secrets_success( $action, $user ) {
Expand All @@ -125,8 +137,8 @@ public function jetpack_verify_secrets_success( $action, $user ) {
*
* @access public
*
* @param string $action Type of secret (one of 'register', 'authorize', 'publicize').
* @param \WP_User $user The user object.
* @param string $action Type of secret (one of 'register', 'authorize', 'publicize').
* @param \WP_User $user The user object.
* @param \WP_Error $error Error object.
*/
public function jetpack_verify_secrets_fail( $action, $user, $error ) {
Expand Down Expand Up @@ -166,11 +178,14 @@ public function wp_login_failed( $login ) {
* @param string|int $error The error code.
* @param \WP_Error $registered The error object.
*/
function jetpack_connection_register_fail( $error, $registered ) {
$this->tracking->record_user_event( 'jpc_register_fail', array(
'error_code' => $error,
'error_message' => $registered->get_error_message()
) );
public function jetpack_connection_register_fail( $error, $registered ) {
$this->tracking->record_user_event(
'jpc_register_fail',
array(
'error_code' => $error,
'error_message' => $registered->get_error_message(),
)
);
}

/**
Expand All @@ -180,10 +195,13 @@ function jetpack_connection_register_fail( $error, $registered ) {
*
* @param string $from The 'from' GET parameter.
*/
function jetpack_connection_register_success( $from ) {
$this->tracking->record_user_event( 'jpc_register_success', array(
'from' => $from
) );
public function jetpack_connection_register_success( $from ) {
$this->tracking->record_user_event(
'jpc_register_success',
array(
'from' => $from,
)
);
}

/**
Expand Down Expand Up @@ -217,7 +235,7 @@ public function jetpack_xmlrpc_server_event( $action, $stage, $parameters = arra
*
* @access public
*/
function jetpack_verify_api_authorization_request_error_double_encode() {
public function jetpack_verify_api_authorization_request_error_double_encode() {
$this->tracking->record_user_event( 'error_double_encode' );
}
}
1 change: 0 additions & 1 deletion tools/phpcs-excludelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@
"projects/plugins/jetpack/sal/class.json-api-site-jetpack-base.php",
"projects/plugins/jetpack/sal/class.json-api-site-jetpack.php",
"projects/plugins/jetpack/sal/class.json-api-token.php",
"projects/plugins/jetpack/src/class-tracking.php",
"projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-authentication.php",
"projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php",
"projects/plugins/jetpack/tests/php/attachment_test_case.php",
Expand Down