PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/config/semrush-client.php +8 -11 18.228.5 View file →
@@ -18,9 +18,9 @@
18 18
19 19 /**
20 20 * The option's key.
21 21 */
22 - const TOKEN_OPTION = 'semrush_tokens';
22 + public const TOKEN_OPTION = 'semrush_tokens';
23 23
24 24 /**
25 25 * SEMrush_Client constructor.
26 26 *
@@ -28,12 +28,9 @@
28 28 * @param WP_Remote_Handler $wp_remote_handler The request handler.
29 29 *
30 30 * @throws Empty_Property_Exception Throws when one of the required properties is empty.
31 31 */
32 - public function __construct(
33 - Options_Helper $options_helper,
34 - WP_Remote_Handler $wp_remote_handler
35 - ) {
32 + public function __construct( Options_Helper $options_helper, WP_Remote_Handler $wp_remote_handler ) {
36 33 $provider = new GenericProvider(
37 34 [
38 35 'clientId' => 'yoast',
39 36 'clientSecret' => 'YdqNsWwnP4vE54WO1ugThKEjGMxMAHJt',
@@ -43,15 +40,15 @@
43 40 'urlResourceOwnerDetails' => 'https://oauth.semrush.com/oauth2/resource',
44 41 ],
45 42 [
46 43 'httpClient' => new Client( [ 'handler' => $wp_remote_handler ] ),
47 - ]
44 + ],
48 45 );
49 46
50 47 parent::__construct(
51 48 self::TOKEN_OPTION,
52 49 $provider,
53 - $options_helper
50 + $options_helper,
54 51 );
55 52 }
56 53
57 54 /**
@@ -56,8 +53,10 @@
56 53
57 54 /**
58 55 * Performs the specified request.
59 56 *
57 + * @codeCoverageIgnore
58 + *
60 59 * @param string $method The HTTP method to use.
61 60 * @param string $url The URL to send the request to.
62 61 * @param array $options The options to pass along to the request.
63 62 *
@@ -65,21 +64,19 @@
65 64 *
66 65 * @throws IdentityProviderException Exception thrown if there's something wrong with the identifying data.
67 66 * @throws Authentication_Failed_Exception Exception thrown if authentication has failed.
68 67 * @throws Empty_Token_Exception Exception thrown if the token is empty.
69 - *
70 - * @codeCoverageIgnore
71 68 */
72 69 public function do_request( $method, $url, array $options ) {
73 70 // Add the access token to the GET parameters as well since this is what
74 71 // the SEMRush API expects.
75 - $options = array_merge_recursive(
72 + $options = \array_merge_recursive(
76 73 $options,
77 74 [
78 75 'params' => [
79 76 'access_token' => $this->get_tokens()->access_token,
80 77 ],
81 - ]
78 + ],
82 79 );
83 80
84 81 return parent::do_request( $method, $url, $options );
85 82 }