PluginProbe
Parse.ly / 3.19.3
Parse.ly v3.19.3
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / src / Models / class-smart-link-status.php

class-smart-link-status.php in Parse.ly 3.19.3, at src/Models/class-smart-link-status.php

47 lines 919 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class for the smart link status enum.
4 *
5 * @package Parsely
6 * @since 3.19.0
7 */
8
9 namespace Parsely\Models;
10
11 /**
12 * Smart Link Status enum.
13 *
14 * Since enum classes are only available since PHP 8, we need to use a class to
15 * simulate an enum.
16 *
17 * @since 3.19.0
18 */
19 class Smart_Link_Status {
20 const ALL = 'all';
21 const APPLIED = 'applied';
22 const PENDING = 'pending';
23
24 /**
25 * Checks if a status is valid.
26 *
27 * @since 3.19.0
28 *
29 * @param string $status The status to check.
30 * @return bool True if the status is valid, false otherwise.
31 */
32 public static function is_valid_status( string $status ): bool {
33 return in_array( $status, self::get_all_statuses(), true );
34 }
35
36 /**
37 * Gets all the statuses.
38 *
39 * @since 3.19.0
40 *
41 * @return array<string> The statuses.
42 */
43 public static function get_all_statuses(): array {
44 return array( self::ALL, self::APPLIED, self::PENDING );
45 }
46 }
47