Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ParamType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 values
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace 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 */
11enum ParamType: string {
12    /** A simple text string or another MessageValue, not otherwise formatted. */
13    case TEXT = 'text';
14
15    /** A number, to be formatted using local digits and separators */
16    case 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    case 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    case 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    case 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    case 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    case 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    case TIME = 'time';
61
62    /**
63     * User Group
64     * @since 1.38
65     */
66    case GROUP = 'group';
67
68    /** A number of bytes. The output will be rounded to an appropriate magnitude. */
69    case SIZE = 'size';
70
71    /** A number of bits per second. The output will be rounded to an appropriate magnitude. */
72    case BITRATE = 'bitrate';
73
74    /** A list of values. Must be used with ListParam. */
75    case LIST = 'list';
76
77    /**
78     * A text parameter which is substituted after formatter processing.
79     *
80     * The creator of the parameter and message is responsible for ensuring
81     * that the value will be safe for the intended output format, and
82     * documenting what that intended output format is.
83     */
84    case RAW = 'raw';
85
86    /**
87     * A text parameter which is substituted after formatter processing.
88     * The output will be escaped as appropriate for the output format so
89     * as to represent plain text rather than any sort of markup.
90     */
91    case PLAINTEXT = 'plaintext';
92
93    /**
94     * Return the ParamTypes, as an array of string flag values.
95     * @return list<string>
96     */
97    public static function values(): array {
98        return array_column( self::cases(), 'value' );
99    }
100}