Debian Codegraph @

includes/libs/Message/ParamType.php

raw symbols SCIP
1 <?php
2
3 namespace Wikimedia\Message;
4
5 /**
6 * The constants used to specify parameter types. The values of the constants
7 * are an unstable implementation detail.
8 *
9 * Unless otherwise noted, these should be used with an instance of ScalarParam.
10 */
11 class ParamType {
12 /** A simple text string or another MessageValue, not otherwise formatted. */
13 public const TEXT = 'text';
14
15 /** A number, to be formatted using local digits and separators */
16 public const NUM = 'num';
17
18 /**
19 * A number of seconds, to be formatted as natural language text.
20 * The value will be output exactly.
21 */
22 public const DURATION_LONG = 'duration';
23
24 /**
25 * A number of seconds, to be formatted as natural language text in an abbreviated way.
26 * The output will be rounded to an appropriate magnitude.
27 */
28 public const DURATION_SHORT = 'period';
29
30 /**
31 * An expiry time.
32 *
33 * The input is either a timestamp in one of the formats accepted by the
34 * Wikimedia\Timestamp library, or "infinity" if the thing doesn't expire.
35 *
36 * The output is a date and time in local format, or a string representing
37 * an "infinite" expiry.
38 */
39 public const EXPIRY = 'expiry';
40
41 /**
42 * A date time in one of the formats accepted by the Wikimedia\Timestamp library.
43 *
44 * The output is a date and time in local format.
45 */
46 public const DATETIME = 'datetime';
47
48 /**
49 * A date in one of the formats accepted by the Wikimedia\Timestamp library.
50 *
51 * The output is a date in local format.
52 */
53 public const DATE = 'date';
54
55 /**
56 * A time in one of the formats accepted by the Wikimedia\Timestamp library.
57 *
58 * The output is a time in local format.
59 */
60 public const TIME = 'time';
61
62 /**
63 * User Group
64 * @since 1.38
65 */
66 public const GROUP = 'group';
67
68 /**
69 * For arbitrary stringable objects
70 * @since 1.38
71 * @deprecated since 1.43
72 */
73 public const OBJECT = 'object';
74
75 /** A number of bytes. The output will be rounded to an appropriate magnitude. */
76 public const SIZE = 'size';
77
78 /** A number of bits per second. The output will be rounded to an appropriate magnitude. */
79 public const BITRATE = 'bitrate';
80
81 /** A list of values. Must be used with ListParam. */
82 public const LIST = 'list';
83
84 /**
85 * A text parameter which is substituted after formatter processing.
86 *
87 * The creator of the parameter and message is responsible for ensuring
88 * that the value will be safe for the intended output format, and
89 * documenting what that intended output format is.
90 */
91 public const RAW = 'raw';
92
93 /**
94 * A text parameter which is substituted after formatter processing.
95 * The output will be escaped as appropriate for the output format so
96 * as to represent plain text rather than any sort of markup.
97 */
98 public const PLAINTEXT = 'plaintext';
99
100 public static function cases(): array {
101 return [
102 self::TEXT,
103 self::NUM,
104 self::DURATION_LONG,
105 self::DURATION_SHORT,
106 self::EXPIRY,
107 self::DATETIME,
108 self::DATE,
109 self::TIME,
110 self::GROUP,
111 self::OBJECT,
112 self::SIZE,
113 self::BITRATE,
114 self::LIST,
115 self::RAW,
116 self::PLAINTEXT,
117 ];
118 }
119 }