PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
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
wordpress-seo / src / myyoast-client / application / exceptions / authorization-flow-exception.php

authorization-flow-exception.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/myyoast-client/application/exceptions/authorization-flow-exception.php

52 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
4 namespace Yoast\WP\SEO\MyYoast_Client\Application\Exceptions;
5
6 use RuntimeException;
7 use Throwable;
8
9 /**
10 * Exception thrown when the authorization flow cannot be started.
11 *
12 * Wraps underlying failures (registration, discovery, invalid parameters)
13 * that prevent building the authorization URL.
14 */
15 class Authorization_Flow_Exception extends RuntimeException {
16
17 /**
18 * The error code identifying the failure reason.
19 *
20 * @var string
21 */
22 private $error_code;
23
24 /**
25 * Authorization_Flow_Exception constructor.
26 *
27 * @param string $error_code The error code.
28 * @param string $error_description A human-readable description.
29 * @param int $code The exception code.
30 * @param Throwable|null $previous The previous exception.
31 */
32 public function __construct( string $error_code, string $error_description = '', int $code = 0, ?Throwable $previous = null ) {
33 $this->error_code = $error_code;
34
35 $message = $error_code;
36 if ( $error_description !== '' ) {
37 $message .= ': ' . $error_description;
38 }
39
40 parent::__construct( $message, $code, $previous );
41 }
42
43 /**
44 * Returns the error code.
45 *
46 * @return string
47 */
48 public function get_error_code(): string {
49 return $this->error_code;
50 }
51 }
52