Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | declare( 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 | namespace Wikimedia\Parsoid\Utils; |
| 23 | |
| 24 | use Wikimedia\JsonCodec\Hint; |
| 25 | use Wikimedia\JsonCodec\JsonCodecable; |
| 26 | |
| 27 | /** |
| 28 | * This is an extension of JsonCodecable which adds some properties useful |
| 29 | * for rich attributes: |
| 30 | * * a `::flatten()` method which provides a plain string form of the data |
| 31 | * which is used for compatibility with HTML semantics, and |
| 32 | * * a `::hint()` method which is used to provide additional class hint |
| 33 | * information for object. The default class hint is the name of the |
| 34 | * class, but if you want to add modifiers, or perhaps use a superclass |
| 35 | * as a hint, this method will allow that sort of customization. |
| 36 | */ |
| 37 | interface RichCodecable extends JsonCodecable { |
| 38 | |
| 39 | /** |
| 40 | * Provide a constructor for a default value for objects of this type. |
| 41 | * @return ?self |
| 42 | */ |
| 43 | public static function defaultValue(): ?self; |
| 44 | |
| 45 | /** |
| 46 | * Provide a JsonCodec `Hint` for serializing objects of this type. |
| 47 | * @return class-string|Hint|null |
| 48 | */ |
| 49 | public static function hint(); |
| 50 | |
| 51 | /** |
| 52 | * Provide a flattened "plain string" form of this data for use |
| 53 | * as the value of a compatibility attribute to implement HTML |
| 54 | * semantics. |
| 55 | * |
| 56 | * @return ?string a plain string, or null to omit the compatibility |
| 57 | * attribute |
| 58 | */ |
| 59 | public function flatten(): ?string; |
| 60 | } |