Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Jetpack_Subscriptions often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Jetpack_Subscriptions, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 46 | class Jetpack_Subscriptions { |
||
| 47 | public $jetpack = false; |
||
| 48 | |||
| 49 | public static $hash; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Singleton |
||
| 53 | * @static |
||
| 54 | */ |
||
| 55 | static function init() { |
||
| 56 | static $instance = false; |
||
| 57 | |||
| 58 | if ( !$instance ) { |
||
| 59 | $instance = new Jetpack_Subscriptions; |
||
| 60 | } |
||
| 61 | |||
| 62 | return $instance; |
||
| 63 | } |
||
| 64 | |||
| 65 | function __construct() { |
||
| 66 | $this->jetpack = Jetpack::init(); |
||
| 67 | |||
| 68 | // Don't use COOKIEHASH as it could be shared across installs && is non-unique in multisite. |
||
| 69 | // @see: https://twitter.com/nacin/status/378246957451333632 |
||
| 70 | self::$hash = md5( get_option( 'siteurl' ) ); |
||
| 71 | |||
| 72 | add_filter( 'jetpack_xmlrpc_methods', array( $this, 'xmlrpc_methods' ) ); |
||
| 73 | |||
| 74 | // @todo remove sync from subscriptions and move elsewhere... |
||
| 75 | |||
| 76 | // Add Configuration Page |
||
| 77 | add_action( 'admin_init', array( $this, 'configure' ) ); |
||
| 78 | |||
| 79 | // Set up the subscription widget. |
||
| 80 | add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
||
| 81 | |||
| 82 | // Catch subscription widget submits |
||
| 83 | if ( isset( $_REQUEST['jetpack_subscriptions_widget'] ) ) |
||
| 84 | add_action( 'template_redirect', array( $this, 'widget_submit' ) ); |
||
| 85 | |||
| 86 | // Set up the comment subscription checkboxes |
||
| 87 | add_action( 'comment_form', array( $this, 'comment_subscribe_init' ) ); |
||
| 88 | |||
| 89 | // Catch comment posts and check for subscriptions. |
||
| 90 | add_action( 'comment_post', array( $this, 'comment_subscribe_submit' ), 50, 2 ); |
||
| 91 | |||
| 92 | // Adds post meta checkbox in the post submit metabox |
||
| 93 | add_action( 'post_submitbox_misc_actions', array( $this, 'subscription_post_page_metabox' ) ); |
||
| 94 | |||
| 95 | add_action( 'transition_post_status', array( $this, 'maybe_send_subscription_email' ), 10, 3 ); |
||
| 96 | } |
||
| 97 | |||
| 98 | function post_is_public( $the_post ) { |
||
| 116 | |||
| 117 | /** |
||
| 118 | * Jetpack_Subscriptions::xmlrpc_methods() |
||
| 119 | * |
||
| 120 | * Register subscriptions methods with the Jetpack XML-RPC server. |
||
| 121 | * @param array $methods |
||
| 122 | */ |
||
| 123 | function xmlrpc_methods( $methods ) { |
||
| 124 | return array_merge( |
||
| 125 | $methods, |
||
| 126 | array( |
||
| 127 | 'jetpack.subscriptions.subscribe' => array( $this, 'subscribe' ), |
||
| 128 | ) |
||
| 129 | ); |
||
| 130 | } |
||
| 131 | |||
| 132 | /* |
||
| 133 | * Disable Subscribe on Single Post |
||
| 134 | * Register post meta |
||
| 135 | */ |
||
| 136 | function subscription_post_page_metabox() { |
||
| 137 | if ( |
||
| 138 | /** |
||
| 139 | * Filter whether or not to show the per-post subscription option. |
||
| 140 | * |
||
| 141 | * @module subscriptions |
||
| 142 | * |
||
| 143 | * @since 3.7.0 |
||
| 144 | * |
||
| 145 | * @param bool true = show checkbox option on all new posts | false = hide the option. |
||
| 146 | */ |
||
| 147 | ! apply_filters( 'jetpack_allow_per_post_subscriptions', false ) ) |
||
| 148 | { |
||
| 149 | return; |
||
| 150 | } |
||
| 151 | |||
| 152 | if ( has_filter( 'jetpack_subscriptions_exclude_these_categories' ) || has_filter( 'jetpack_subscriptions_include_only_these_categories' ) ) { |
||
| 153 | return; |
||
| 154 | } |
||
| 155 | |||
| 156 | global $post; |
||
| 157 | $disable_subscribe_value = get_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', true ); |
||
| 158 | // Nonce it |
||
| 159 | wp_nonce_field( 'disable_subscribe', 'disable_subscribe_nonce' ); |
||
| 160 | // only show checkbox if post hasn't been published and is a 'post' post type. |
||
| 161 | if ( get_post_status( $post->ID ) !== 'publish' && get_post_type( $post->ID ) == 'post' ) : ?> |
||
| 162 | <div class="misc-pub-section"> |
||
| 163 | <label for="_jetpack_dont_email_post_to_subs"><?php _e( 'Jetpack Subscriptions:', 'jetpack' ); ?></label><br> |
||
| 164 | <input type="checkbox" name="_jetpack_dont_email_post_to_subs" id="jetpack-per-post-subscribe" value="1" <?php checked( $disable_subscribe_value, 1, true ); ?> /> |
||
| 165 | <?php _e( 'Don’t send this to subscribers', 'jetpack' ); ?> |
||
| 166 | </div> |
||
| 167 | <?php endif; |
||
| 168 | } |
||
| 169 | |||
| 170 | /** |
||
| 171 | * Checks whether or not the post should be emailed to subscribers |
||
| 172 | * |
||
| 173 | * It checks for the following things in order: |
||
| 174 | * - Usage of filter jetpack_subscriptions_exclude_these_categories |
||
| 175 | * - Usage of filter jetpack_subscriptions_include_only_these_categories |
||
| 176 | * - Existence of the per-post checkbox option |
||
| 177 | * |
||
| 178 | * Only one of these can be used at any given time. |
||
| 179 | * |
||
| 180 | * @param $new_status string - the "new" post status of the transition when saved |
||
| 181 | * @param $old_status string - the "old" post status of the transition when saved |
||
| 182 | * @param $post obj - The post object |
||
| 183 | */ |
||
| 184 | function maybe_send_subscription_email( $new_status, $old_status, $post ) { |
||
| 185 | // Only do things on publish |
||
| 186 | if ( 'publish' !== $new_status ) { |
||
| 187 | return; |
||
| 188 | } |
||
| 189 | if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
||
| 190 | return; |
||
| 191 | } |
||
| 192 | |||
| 193 | /** |
||
| 194 | * Array of categories that will never trigger subscription emails. |
||
| 195 | * |
||
| 196 | * Will not send subscription emails from any post from within these categories. |
||
| 197 | * |
||
| 198 | * @module subscriptions |
||
| 199 | * |
||
| 200 | * @since 3.7.0 |
||
| 201 | * |
||
| 202 | * @param array $args Array of category slugs or ID's. |
||
| 203 | */ |
||
| 204 | $excluded_categories = apply_filters( 'jetpack_subscriptions_exclude_these_categories', array() ); |
||
| 205 | |||
| 206 | // Never email posts from these categories |
||
| 207 | View Code Duplication | if ( ! empty( $excluded_categories ) && in_category( $excluded_categories, $post->ID ) ) { |
|
| 208 | update_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', 1 ); |
||
| 209 | } |
||
| 210 | |||
| 211 | /** |
||
| 212 | * ONLY send subscription emails for these categories |
||
| 213 | * |
||
| 214 | * Will ONLY send subscription emails to these categories. |
||
| 215 | * |
||
| 216 | * @module subscriptions |
||
| 217 | * |
||
| 218 | * @since 3.7.0 |
||
| 219 | * |
||
| 220 | * @param array $args Array of category slugs or ID's. |
||
| 221 | */ |
||
| 222 | $only_these_categories = apply_filters( 'jetpack_subscriptions_exclude_all_categories_except', array() ); |
||
| 223 | |||
| 224 | // Only emails posts from these categories |
||
| 225 | View Code Duplication | if ( ! empty( $only_these_categories ) && ! in_category( $only_these_categories, $post->ID ) ) { |
|
| 226 | update_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', 1 ); |
||
| 227 | } |
||
| 228 | |||
| 229 | // Email the post, depending on the checkbox option |
||
| 230 | if ( ! empty( $_POST['disable_subscribe_nonce'] ) && wp_verify_nonce( $_POST['disable_subscribe_nonce'], 'disable_subscribe' ) ) { |
||
| 231 | if ( isset( $_POST['_jetpack_dont_email_post_to_subs'] ) ) { |
||
| 232 | update_post_meta( $post->ID, '_jetpack_dont_email_post_to_subs', $_POST['_jetpack_dont_email_post_to_subs'] ); |
||
| 233 | } |
||
| 234 | } |
||
| 235 | } |
||
| 236 | |||
| 237 | /** |
||
| 238 | * Jetpack_Subscriptions::configure() |
||
| 239 | * |
||
| 240 | * Jetpack Subscriptions configuration screen. |
||
| 241 | */ |
||
| 242 | function configure() { |
||
| 243 | // Create the section |
||
| 244 | add_settings_section( |
||
| 245 | 'jetpack_subscriptions', |
||
| 246 | __( 'Jetpack Subscriptions Settings', 'jetpack' ), |
||
| 247 | array( $this, 'subscriptions_settings_section' ), |
||
| 248 | 'discussion' |
||
| 249 | ); |
||
| 250 | |||
| 251 | /** Subscribe to Posts ***************************************************/ |
||
| 252 | |||
| 253 | add_settings_field( |
||
| 254 | 'jetpack_subscriptions_post_subscribe', |
||
| 255 | __( 'Follow Blog', 'jetpack' ), |
||
| 256 | array( $this, 'subscription_post_subscribe_setting' ), |
||
| 257 | 'discussion', |
||
| 258 | 'jetpack_subscriptions' |
||
| 259 | ); |
||
| 260 | |||
| 261 | register_setting( |
||
| 262 | 'discussion', |
||
| 263 | 'stb_enabled' |
||
| 264 | ); |
||
| 265 | |||
| 266 | /** Subscribe to Comments ******************************************************/ |
||
| 267 | |||
| 268 | add_settings_field( |
||
| 269 | 'jetpack_subscriptions_comment_subscribe', |
||
| 270 | __( 'Follow Comments', 'jetpack' ), |
||
| 271 | array( $this, 'subscription_comment_subscribe_setting' ), |
||
| 272 | 'discussion', |
||
| 273 | 'jetpack_subscriptions' |
||
| 274 | ); |
||
| 275 | |||
| 276 | register_setting( |
||
| 277 | 'discussion', |
||
| 278 | 'stc_enabled' |
||
| 279 | ); |
||
| 280 | |||
| 281 | /** Subscription Messaging Options ******************************************************/ |
||
| 282 | |||
| 283 | register_setting( |
||
| 284 | 'reading', |
||
| 285 | 'subscription_options', |
||
| 286 | array( $this, 'validate_settings' ) |
||
| 287 | ); |
||
| 288 | |||
| 289 | add_settings_section( |
||
| 290 | 'email_settings', |
||
| 291 | __( 'Follower Settings', 'jetpack' ), |
||
| 292 | array( $this, 'reading_section' ), |
||
| 293 | 'reading' |
||
| 294 | ); |
||
| 295 | |||
| 296 | add_settings_field( |
||
| 297 | 'invitation', |
||
| 298 | __( 'Blog follow email text', 'jetpack' ), |
||
| 299 | array( $this, 'setting_invitation' ), |
||
| 300 | 'reading', |
||
| 301 | 'email_settings' |
||
| 302 | ); |
||
| 303 | |||
| 304 | add_settings_field( |
||
| 305 | 'comment-follow', |
||
| 306 | __( 'Comment follow email text', 'jetpack' ), |
||
| 307 | array( $this, 'setting_comment_follow' ), |
||
| 308 | 'reading', |
||
| 309 | 'email_settings' |
||
| 310 | ); |
||
| 311 | } |
||
| 312 | |||
| 313 | /** |
||
| 314 | * Discussions setting section blurb |
||
| 315 | * |
||
| 316 | */ |
||
| 317 | function subscriptions_settings_section() { |
||
| 318 | ?> |
||
| 319 | |||
| 320 | <p id="jetpack-subscriptions-settings"><?php _e( 'Change whether your visitors can subscribe to your posts or comments or both.', 'jetpack' ); ?></p> |
||
| 321 | |||
| 322 | <?php |
||
| 323 | } |
||
| 324 | |||
| 325 | /** |
||
| 326 | * Post Subscriptions Toggle |
||
| 327 | * |
||
| 328 | */ |
||
| 329 | View Code Duplication | function subscription_post_subscribe_setting() { |
|
| 330 | |||
| 331 | $stb_enabled = get_option( 'stb_enabled', 1 ); ?> |
||
| 332 | |||
| 333 | <p class="description"> |
||
| 334 | <input type="checkbox" name="stb_enabled" id="jetpack-post-subscribe" value="1" <?php checked( $stb_enabled, 1 ); ?> /> |
||
| 335 | <?php _e( "Show a <em>'follow blog'</em> option in the comment form", 'jetpack' ); ?> |
||
| 336 | </p> |
||
| 337 | <?php |
||
| 338 | } |
||
| 339 | |||
| 340 | /** |
||
| 341 | * Comments Subscriptions Toggle |
||
| 342 | * |
||
| 343 | */ |
||
| 344 | View Code Duplication | function subscription_comment_subscribe_setting() { |
|
| 345 | |||
| 346 | $stc_enabled = get_option( 'stc_enabled', 1 ); ?> |
||
| 347 | |||
| 348 | <p class="description"> |
||
| 349 | <input type="checkbox" name="stc_enabled" id="jetpack-comment-subscribe" value="1" <?php checked( $stc_enabled, 1 ); ?> /> |
||
| 350 | <?php _e( "Show a <em>'follow comments'</em> option in the comment form", 'jetpack' ); ?> |
||
| 351 | </p> |
||
| 352 | |||
| 353 | <?php |
||
| 354 | } |
||
| 355 | |||
| 356 | function validate_settings( $settings ) { |
||
| 357 | global $allowedposttags; |
||
| 358 | |||
| 359 | $default = $this->get_default_settings(); |
||
| 360 | |||
| 361 | // Blog Follow |
||
| 362 | $settings['invitation'] = trim( wp_kses( $settings['invitation'], $allowedposttags ) ); |
||
| 363 | if ( empty( $settings['invitation'] ) ) |
||
| 364 | $settings['invitation'] = $default['invitation']; |
||
| 365 | |||
| 366 | // Comments Follow (single post) |
||
| 367 | $settings['comment_follow'] = trim( wp_kses( $settings['comment_follow'], $allowedposttags ) ); |
||
| 368 | if ( empty( $settings['comment_follow'] ) ) |
||
| 369 | $settings['comment_follow'] = $default['comment_follow']; |
||
| 370 | |||
| 371 | return $settings; |
||
| 372 | } |
||
| 373 | |||
| 374 | public function reading_section() { |
||
| 375 | echo '<p id="follower-settings">'; |
||
| 376 | _e( 'These settings change emails sent from your blog to followers.', 'jetpack' ); |
||
| 377 | echo '</p>'; |
||
| 378 | } |
||
| 379 | |||
| 380 | public function setting_invitation() { |
||
| 381 | $settings = $this->get_settings(); |
||
| 382 | echo '<textarea name="subscription_options[invitation]" class="large-text" cols="50" rows="5">' . esc_textarea( $settings['invitation'] ) . '</textarea>'; |
||
| 383 | echo '<p><span class="description">'.__( 'Introduction text sent when someone follows your blog. (Site and confirmation details will be automatically added for you.)', 'jetpack' ).'</span></p>'; |
||
| 384 | } |
||
| 385 | |||
| 386 | public function setting_comment_follow() { |
||
| 387 | $settings = $this->get_settings(); |
||
| 388 | echo '<textarea name="subscription_options[comment_follow]" class="large-text" cols="50" rows="5">' . esc_textarea( $settings['comment_follow'] ) . '</textarea>'; |
||
| 389 | echo '<p><span class="description">'.__( 'Introduction text sent when someone follows a post on your blog. (Site and confirmation details will be automatically added for you.)', 'jetpack' ).'</span></p>'; |
||
| 390 | } |
||
| 391 | |||
| 392 | function get_default_settings() { |
||
| 393 | return array( |
||
| 394 | 'invitation' => __( "Howdy.\n\nYou recently followed this blog's posts. This means you will receive each new post by email.\n\nTo activate, click confirm below. If you believe this is an error, ignore this message and we'll never bother you again.", 'jetpack' ), |
||
| 395 | 'comment_follow' => __( "Howdy.\n\nYou recently followed one of my posts. This means you will receive an email when new comments are posted.\n\nTo activate, click confirm below. If you believe this is an error, ignore this message and we'll never bother you again.", 'jetpack' ) |
||
| 396 | ); |
||
| 397 | } |
||
| 398 | |||
| 399 | function get_settings() { |
||
| 402 | |||
| 403 | /** |
||
| 404 | * Jetpack_Subscriptions::subscribe() |
||
| 405 | * |
||
| 406 | * Send a synchronous XML-RPC subscribe to blog posts or subscribe to post comments request. |
||
| 407 | * |
||
| 408 | * @param string $email |
||
| 409 | * @param array $post_ids (optional) defaults to 0 for blog posts only: array of post IDs to subscribe to blog's posts |
||
| 410 | * @param bool $async (optional) Should the subscription be performed asynchronously? Defaults to true. |
||
| 411 | * |
||
| 412 | * @return true|Jetpack_Error true on success |
||
| 413 | * invalid_email : not a valid email address |
||
| 414 | * invalid_post_id : not a valid post ID |
||
| 415 | * unknown_post_id : unknown post |
||
| 416 | * not_subscribed : strange error. Jetpack servers at WordPress.com could subscribe the email. |
||
| 417 | * disabled : Site owner has disabled subscriptions. |
||
| 418 | * active : Already subscribed. |
||
| 419 | * unknown : strange error. Jetpack servers at WordPress.com returned something malformed. |
||
| 420 | * unknown_status : strange error. Jetpack servers at WordPress.com returned something I didn't understand. |
||
| 421 | */ |
||
| 422 | function subscribe( $email, $post_ids = 0, $async = true, $extra_data = array() ) { |
||
| 423 | if ( !is_email( $email ) ) { |
||
| 424 | return new Jetpack_Error( 'invalid_email' ); |
||
| 425 | } |
||
| 426 | |||
| 427 | if ( !$async ) { |
||
| 428 | Jetpack::load_xml_rpc_client(); |
||
| 429 | $xml = new Jetpack_IXR_ClientMulticall(); |
||
| 430 | } |
||
| 431 | |||
| 432 | foreach ( (array) $post_ids as $post_id ) { |
||
| 433 | $post_id = (int) $post_id; |
||
| 434 | if ( $post_id < 0 ) { |
||
| 435 | return new Jetpack_Error( 'invalid_post_id' ); |
||
| 436 | } else if ( $post_id && !$post = get_post( $post_id ) ) { |
||
| 437 | return new Jetpack_Error( 'unknown_post_id' ); |
||
| 438 | } |
||
| 439 | |||
| 440 | if ( $async ) { |
||
| 441 | Jetpack::xmlrpc_async_call( 'jetpack.subscribeToSite', $email, $post_id, serialize( $extra_data ) ); |
||
| 442 | } else { |
||
| 443 | $xml->addCall( 'jetpack.subscribeToSite', $email, $post_id, serialize( $extra_data ) ); |
||
| 444 | } |
||
| 445 | } |
||
| 446 | |||
| 447 | if ( $async ) { |
||
| 448 | return; |
||
| 449 | } |
||
| 450 | |||
| 451 | // Call |
||
| 452 | $xml->query(); |
||
| 453 | |||
| 454 | if ( $xml->isError() ) { |
||
| 455 | return $xml->get_jetpack_error(); |
||
| 456 | } |
||
| 457 | |||
| 458 | $responses = $xml->getResponse(); |
||
| 459 | |||
| 460 | $r = array(); |
||
| 461 | foreach ( (array) $responses as $response ) { |
||
| 462 | if ( isset( $response['faultCode'] ) || isset( $response['faultString'] ) ) { |
||
| 463 | $r[] = $xml->get_jetpack_error( $response['faultCode'], $response['faultString'] ); |
||
| 464 | continue; |
||
| 465 | } |
||
| 466 | |||
| 467 | if ( !is_array( $response[0] ) || empty( $response[0]['status'] ) ) { |
||
| 468 | $r[] = new Jetpack_Error( 'unknown' ); |
||
| 469 | continue; |
||
| 470 | } |
||
| 471 | |||
| 472 | switch ( $response[0]['status'] ) { |
||
| 473 | case 'error' : |
||
| 474 | $r[] = new Jetpack_Error( 'not_subscribed' ); |
||
| 475 | continue 2; |
||
| 476 | case 'disabled' : |
||
| 477 | $r[] = new Jetpack_Error( 'disabled' ); |
||
| 478 | continue 2; |
||
| 479 | case 'active' : |
||
| 480 | $r[] = new Jetpack_Error( 'active' ); |
||
| 481 | continue 2; |
||
| 482 | case 'pending' : |
||
| 483 | $r[] = true; |
||
| 484 | continue 2; |
||
| 485 | default : |
||
| 486 | $r[] = new Jetpack_Error( 'unknown_status', (string) $response[0]['status'] ); |
||
| 487 | continue 2; |
||
| 488 | } |
||
| 489 | } |
||
| 490 | |||
| 491 | return $r; |
||
| 492 | } |
||
| 493 | |||
| 494 | /** |
||
| 495 | * Jetpack_Subscriptions::widget_init() |
||
| 496 | * |
||
| 497 | * Initialize and register the Jetpack Subscriptions widget. |
||
| 498 | */ |
||
| 499 | function widget_init() { |
||
| 502 | |||
| 503 | /** |
||
| 504 | * Jetpack_Subscriptions::widget_submit() |
||
| 505 | * |
||
| 506 | * When a user submits their email via the blog subscription widget, check the details and call the subsribe() method. |
||
| 507 | */ |
||
| 508 | function widget_submit() { |
||
| 509 | // Check the nonce. |
||
| 510 | if ( is_user_logged_in() ) { |
||
| 511 | check_admin_referer( 'blogsub_subscribe_' . get_current_blog_id() ); |
||
| 512 | } |
||
| 513 | |||
| 514 | if ( empty( $_REQUEST['email'] ) ) |
||
| 515 | return false; |
||
| 516 | |||
| 517 | $redirect_fragment = false; |
||
| 584 | |||
| 585 | /** |
||
| 586 | * Jetpack_Subscriptions::comment_subscribe_init() |
||
| 587 | * |
||
| 588 | * Set up and add the comment subscription checkbox to the comment form. |
||
| 589 | */ |
||
| 590 | function comment_subscribe_init() { |
||
| 659 | |||
| 660 | /** |
||
| 661 | * Jetpack_Subscriptions::comment_subscribe_init() |
||
| 662 | * |
||
| 663 | * When a user checks the comment subscribe box and submits a comment, subscribe them to the comment thread. |
||
| 664 | */ |
||
| 665 | function comment_subscribe_submit( $comment_id, $approved ) { |
||
| 697 | |||
| 698 | /** |
||
| 699 | * Jetpack_Subscriptions::set_cookies() |
||
| 700 | * |
||
| 701 | * Set a cookie to save state on the comment and post subscription checkboxes. |
||
| 702 | */ |
||
| 703 | function set_cookies( $comments = true, $posts = true ) { |
||
| 739 | } |
||
| 740 | |||
| 1053 |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exitexpression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.