Skip to content

Commit 139a172

Browse files
authored
Apply formatting baseline across all PHP files (#2159)
1 parent ed38818 commit 139a172

File tree

70 files changed

+160
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+160
-168
lines changed

build/followers/render.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Activitypub\Blocks;
99
use Activitypub\Collection\Actors;
1010
use Activitypub\Collection\Followers;
11+
1112
use function Activitypub\is_activitypub_request;
1213
use function Activitypub\object_to_uri;
1314

build/reactions/render.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
* @package ActivityPub
66
*/
77

8-
use Activitypub\Comment;
98
use Activitypub\Blocks;
9+
use Activitypub\Comment;
10+
1011
use function Activitypub\is_activitypub_request;
1112

1213
if ( is_activitypub_request() || is_feed() ) {

build/remote-reply/render.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
use Activitypub\Blocks;
9+
910
use function Activitypub\is_activitypub_request;
1011

1112
if ( is_activitypub_request() || is_feed() ) {

includes/class-http.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Activitypub;
99

10-
use WP_Error;
1110
use Activitypub\Collection\Actors;
1211

1312
/**
@@ -23,7 +22,7 @@ class Http {
2322
* @param string $body The Post Body.
2423
* @param int $user_id The WordPress User-ID.
2524
*
26-
* @return array|WP_Error The POST Response or an WP_Error.
25+
* @return array|\WP_Error The POST Response or an WP_Error.
2726
*/
2827
public static function post( $url, $body, $user_id ) {
2928
/**
@@ -60,7 +59,7 @@ public static function post( $url, $body, $user_id ) {
6059
$code = \wp_remote_retrieve_response_code( $response );
6160

6261
if ( $code >= 400 ) {
63-
$response = new WP_Error(
62+
$response = new \WP_Error(
6463
$code,
6564
__( 'Failed HTTP Request', 'activitypub' ),
6665
array(
@@ -73,10 +72,10 @@ public static function post( $url, $body, $user_id ) {
7372
/**
7473
* Action to save the response of the remote POST request.
7574
*
76-
* @param array|WP_Error $response The response of the remote POST request.
77-
* @param string $url The URL endpoint.
78-
* @param string $body The Post Body.
79-
* @param int $user_id The WordPress User-ID.
75+
* @param array|\WP_Error $response The response of the remote POST request.
76+
* @param string $url The URL endpoint.
77+
* @param string $body The Post Body.
78+
* @param int $user_id The WordPress User-ID.
8079
*/
8180
\do_action( 'activitypub_safe_remote_post_response', $response, $url, $body, $user_id );
8281

@@ -89,7 +88,7 @@ public static function post( $url, $body, $user_id ) {
8988
* @param string $url The URL endpoint.
9089
* @param bool|int $cached Optional. Whether the result should be cached, or its duration. Default false.
9190
*
92-
* @return array|WP_Error The GET Response or a WP_Error.
91+
* @return array|\WP_Error The GET Response or a WP_Error.
9392
*/
9493
public static function get( $url, $cached = false ) {
9594
/**
@@ -108,8 +107,8 @@ public static function get( $url, $cached = false ) {
108107
/**
109108
* Action to save the response of the remote GET request.
110109
*
111-
* @param array|WP_Error $response The response of the remote GET request.
112-
* @param string $url The URL endpoint.
110+
* @param array|\WP_Error $response The response of the remote GET request.
111+
* @param string $url The URL endpoint.
113112
*/
114113
\do_action( 'activitypub_safe_remote_get_response', $response, $url );
115114

@@ -152,14 +151,14 @@ public static function get( $url, $cached = false ) {
152151
$code = \wp_remote_retrieve_response_code( $response );
153152

154153
if ( $code >= 400 ) {
155-
$response = new WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ), array( 'status' => $code ) );
154+
$response = new \WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ), array( 'status' => $code ) );
156155
}
157156

158157
/**
159158
* Action to save the response of the remote GET request.
160159
*
161-
* @param array|WP_Error $response The response of the remote GET request.
162-
* @param string $url The URL endpoint.
160+
* @param array|\WP_Error $response The response of the remote GET request.
161+
* @param string $url The URL endpoint.
163162
*/
164163
\do_action( 'activitypub_safe_remote_get_response', $response, $url );
165164

@@ -204,7 +203,7 @@ public static function generate_cache_key( $url ) {
204203
* @param array|string $url_or_object The Object or the Object URL.
205204
* @param bool $cached Optional. Whether the result should be cached. Default true.
206205
*
207-
* @return array|WP_Error The Object data as array or WP_Error on failure.
206+
* @return array|\WP_Error The Object data as array or WP_Error on failure.
208207
*/
209208
public static function get_remote_object( $url_or_object, $cached = true ) {
210209
/**
@@ -225,7 +224,7 @@ public static function get_remote_object( $url_or_object, $cached = true ) {
225224
}
226225

227226
if ( ! $url ) {
228-
return new WP_Error(
227+
return new \WP_Error(
229228
'activitypub_no_valid_actor_identifier',
230229
\__( 'The "actor" identifier is not valid', 'activitypub' ),
231230
array(
@@ -251,7 +250,7 @@ public static function get_remote_object( $url_or_object, $cached = true ) {
251250
}
252251

253252
if ( ! \wp_http_validate_url( $url ) ) {
254-
return new WP_Error(
253+
return new \WP_Error(
255254
'activitypub_no_valid_object_url',
256255
\__( 'The "object" is/has no valid URL', 'activitypub' ),
257256
array(
@@ -271,7 +270,7 @@ public static function get_remote_object( $url_or_object, $cached = true ) {
271270
$data = \json_decode( $data, true );
272271

273272
if ( ! $data ) {
274-
return new WP_Error(
273+
return new \WP_Error(
275274
'activitypub_invalid_json',
276275
\__( 'No valid JSON data', 'activitypub' ),
277276
array(

includes/class-move.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace Activitypub;
99

10-
use Activitypub\Activity\Actor;
1110
use Activitypub\Activity\Activity;
11+
use Activitypub\Activity\Actor;
1212
use Activitypub\Collection\Actors;
1313
use Activitypub\Model\Blog;
1414
use Activitypub\Model\User;

includes/class-scheduler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
use Activitypub\Activity\Activity;
1111
use Activitypub\Activity\Base_Object;
12-
use Activitypub\Scheduler\Post;
13-
use Activitypub\Scheduler\Actor;
14-
use Activitypub\Scheduler\Comment;
1512
use Activitypub\Collection\Actors;
1613
use Activitypub\Collection\Outbox;
14+
use Activitypub\Scheduler\Actor;
15+
use Activitypub\Scheduler\Comment;
16+
use Activitypub\Scheduler\Post;
1717

1818
/**
1919
* Scheduler class.

includes/class-signature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
namespace Activitypub;
99

1010
use Activitypub\Collection\Actors;
11-
use Activitypub\Signature\Http_Signature_Draft;
1211
use Activitypub\Signature\Http_Message_Signature;
12+
use Activitypub\Signature\Http_Signature_Draft;
1313

1414
/**
1515
* ActivityPub Signature Class.

includes/class-webfinger.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Activitypub;
99

10-
use WP_Error;
1110
use Activitypub\Activity\Actor;
1211
use Activitypub\Collection\Actors;
1312

@@ -40,7 +39,7 @@ public static function get_user_resource( $user_id ) {
4039
*
4140
* @param string $uri The WebFinger Resource.
4241
*
43-
* @return string|WP_Error The URL or WP_Error.
42+
* @return string|\WP_Error The URL or WP_Error.
4443
*/
4544
public static function resolve( $uri ) {
4645
$data = self::get_data( $uri );
@@ -50,7 +49,7 @@ public static function resolve( $uri ) {
5049
}
5150

5251
if ( ! is_array( $data ) || empty( $data['links'] ) ) {
53-
return new WP_Error(
52+
return new \WP_Error(
5453
'webfinger_missing_links',
5554
__( 'No valid Link elements found.', 'activitypub' ),
5655
array(
@@ -73,7 +72,7 @@ public static function resolve( $uri ) {
7372
}
7473
}
7574

76-
return new WP_Error(
75+
return new \WP_Error(
7776
'webfinger_url_no_activitypub',
7877
__( 'The Site supports WebFinger but not ActivityPub', 'activitypub' ),
7978
array(
@@ -90,7 +89,7 @@ public static function resolve( $uri ) {
9089
*
9190
* @param string $uri The URI (acct:, mailto:, http:, https:).
9291
*
93-
* @return string|WP_Error Error or acct URI.
92+
* @return string|\WP_Error Error or acct URI.
9493
*/
9594
public static function uri_to_acct( $uri ) {
9695
$data = self::get_data( $uri );
@@ -116,7 +115,7 @@ public static function uri_to_acct( $uri ) {
116115
}
117116
}
118117

119-
return new WP_Error(
118+
return new \WP_Error(
120119
'webfinger_url_no_acct',
121120
__( 'No acct URI found.', 'activitypub' ),
122121
array(
@@ -132,11 +131,11 @@ public static function uri_to_acct( $uri ) {
132131
*
133132
* @param string $url The URI (acct:, mailto:, http:, https:).
134133
*
135-
* @return WP_Error|array Error reaction or array with identifier and host as values.
134+
* @return \WP_Error|array Error reaction or array with identifier and host as values.
136135
*/
137136
public static function get_identifier_and_host( $url ) {
138137
if ( ! $url ) {
139-
return new WP_Error(
138+
return new \WP_Error(
140139
'webfinger_invalid_identifier',
141140
__( 'Invalid Identifier', 'activitypub' ),
142141
array(
@@ -173,7 +172,7 @@ public static function get_identifier_and_host( $url ) {
173172
}
174173

175174
if ( empty( $host ) ) {
176-
return new WP_Error(
175+
return new \WP_Error(
177176
'webfinger_invalid_identifier',
178177
__( 'Invalid Identifier', 'activitypub' ),
179178
array(
@@ -191,7 +190,7 @@ public static function get_identifier_and_host( $url ) {
191190
*
192191
* @param string $uri The Identifier: <identifier>@<host> or URI.
193192
*
194-
* @return WP_Error|array Error reaction or array with identifier and host as values.
193+
* @return \WP_Error|array Error reaction or array with identifier and host as values.
195194
*/
196195
public static function get_data( $uri ) {
197196
$identifier_and_host = self::get_identifier_and_host( $uri );
@@ -223,7 +222,7 @@ public static function get_data( $uri ) {
223222
);
224223

225224
if ( \is_wp_error( $response ) || \wp_remote_retrieve_response_code( $response ) >= 400 ) {
226-
return new WP_Error(
225+
return new \WP_Error(
227226
'webfinger_url_not_accessible',
228227
__( 'The WebFinger Resource is not accessible.', 'activitypub' ),
229228
array(
@@ -246,7 +245,7 @@ public static function get_data( $uri ) {
246245
*
247246
* @param string $uri The WebFinger Resource URI.
248247
*
249-
* @return string|WP_Error Error or the Remote-Follow endpoint URI.
248+
* @return string|\WP_Error Error or the Remote-Follow endpoint URI.
250249
*/
251250
public static function get_remote_follow_endpoint( $uri ) {
252251
$data = self::get_data( $uri );
@@ -256,7 +255,7 @@ public static function get_remote_follow_endpoint( $uri ) {
256255
}
257256

258257
if ( empty( $data['links'] ) ) {
259-
return new WP_Error(
258+
return new \WP_Error(
260259
'webfinger_missing_links',
261260
__( 'No valid Link elements found.', 'activitypub' ),
262261
array(
@@ -272,7 +271,7 @@ public static function get_remote_follow_endpoint( $uri ) {
272271
}
273272
}
274273

275-
return new WP_Error(
274+
return new \WP_Error(
276275
'webfinger_missing_remote_follow_endpoint',
277276
__( 'No valid Remote-Follow endpoint found.', 'activitypub' ),
278277
array(

includes/collection/class-actors.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
namespace Activitypub\Collection;
99

10+
use Activitypub\Activity\Actor;
1011
use Activitypub\Http;
11-
use Activitypub\Model\User;
12-
use Activitypub\Model\Blog;
1312
use Activitypub\Model\Application;
14-
use Activitypub\Activity\Actor;
13+
use Activitypub\Model\Blog;
14+
use Activitypub\Model\User;
1515

1616
use function Activitypub\get_remote_metadata_by_actor;
1717
use function Activitypub\is_actor;

includes/collection/class-inbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use Activitypub\Activity\Activity;
1111
use Activitypub\Activity\Base_Object;
1212

13-
use function Activitypub\object_to_uri;
1413
use function Activitypub\is_activity_public;
14+
use function Activitypub\object_to_uri;
1515

1616
/**
1717
* ActivityPub Inbox Collection

0 commit comments

Comments
 (0)