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