Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
MessageParam
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 getType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getValue
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 dump
n/a
0 / 0
n/a
0 / 0
0
 isSameAs
n/a
0 / 0
n/a
0 / 0
0
1<?php
2declare( strict_types = 1 );
3
4/**
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23namespace Wikimedia\Message;
24
25use Wikimedia\JsonCodec\JsonCodecable;
26
27/**
28 * Value object representing a message parameter that consists of a list of values.
29 *
30 * Message parameter classes are pure value objects and are newable and (de)serializable.
31 */
32abstract class MessageParam implements JsonCodecable {
33
34    protected string $type;
35    /** @var mixed */
36    protected $value;
37
38    /**
39     * Get the type of the parameter.
40     *
41     * @return string One of the ParamType constants
42     */
43    public function getType(): string {
44        return $this->type;
45    }
46
47    /**
48     * Get the input value of the parameter
49     *
50     * @return mixed
51     */
52    public function getValue() {
53        return $this->value;
54    }
55
56    /**
57     * Dump the object for testing/debugging
58     *
59     * @return string
60     */
61    abstract public function dump(): string;
62
63    /**
64     * Equality testing.
65     */
66    abstract public function isSameAs( MessageParam $mp ): bool;
67}