• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 512321137492bbae6803200cb9598c33529731ee

27 May 2025 10:27AM UTC coverage: 51.51% (-5.5%) from 56.997%
512321137492bbae6803200cb9598c33529731ee

Pull #22264

github

web-flow
Merge af47e48fa into 196182b4e
Pull Request #22264: Move and refactor ai generator helper

7875 of 14311 branches covered (55.03%)

Branch coverage included in aggregate %.

0 of 277 new or added lines in 16 files covered. (0.0%)

29138 of 57545 relevant lines covered (50.64%)

41488.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/ai-consent/application/consent-handler.php
1
<?php
2

3
namespace Yoast\WP\SEO\AI_Consent\Application;
4

5
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Forbidden_Exception;
6
use Yoast\WP\SEO\Helpers\User_Helper;
7

8
/**
9
 * Class Consent_Handler
10
 * Handles the consent given or revoked by the user.
11
 */
12
class Consent_Handler implements Consent_Handler_Interface {
13

14
        /**
15
         * Holds the user helper instance.
16
         *
17
         * @var User_Helper
18
         */
19
        private $user_helper;
20

21
        /**
22
         * Class constructor.
23
         *
24
         * @param User_Helper $user_helper The user helper.
25
         */
NEW
26
        public function __construct( User_Helper $user_helper ) {
×
NEW
27
                $this->user_helper = $user_helper;
×
28
        }
29

30
        /**
31
         * Handles consent revoked.
32
         *
33
         * By deleting the consent user metadata from the database.
34
         * And then throwing a Forbidden_Exception.
35
         *
36
         * @param int $user_id     The user ID.
37
         * @param int $status_code The status code. Defaults to 403.
38
         *
39
         * @return Forbidden_Exception The Forbidden_Exception.
40
         */
NEW
41
        public function handle_consent_revoked( int $user_id, int $status_code = 403 ): Forbidden_Exception {
×
NEW
42
                $this->user_helper->delete_meta( $user_id, '_yoast_wpseo_ai_consent' );
×
43

NEW
44
                return new Forbidden_Exception( 'CONSENT_REVOKED', $status_code );
×
45
        }
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc