MediaWiki master
UnicodeConstraint.php
Go to the documentation of this file.
1<?php
8
10
18
22 public const VALID_UNICODE = 'ℳ𝒲β™₯π“Šπ“ƒπ’Ύπ’Έβ„΄π’Ήβ„―';
23
27 public function __construct(
28 private readonly string $input,
29 ) {
30 }
31
32 public function checkConstraint(): string {
33 if ( $this->input === self::VALID_UNICODE ) {
34 return self::CONSTRAINT_PASSED;
35 }
36 return self::CONSTRAINT_FAILED;
37 }
38
39 public function getLegacyStatus(): StatusValue {
40 $statusValue = StatusValue::newGood();
41 if ( $this->input !== self::VALID_UNICODE ) {
42 $statusValue->fatal( 'unicode-support-fail' );
43 $statusValue->value = self::AS_UNICODE_NOT_SUPPORTED;
44 }
45 return $statusValue;
46 }
47
48}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:68
getLegacyStatus()
Get the legacy status for failure (or success)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
fatal( $message,... $parameters)
Add an error and set OK to false, indicating that the operation as a whole was fatal.
Interface for all constraints that can prevent edits.