MediaWiki master
UnicodeConstraint.php
Go to the documentation of this file.
1<?php
22
23use StatusValue;
24
32
37 public const VALID_UNICODE = 'ℳ𝒲β™₯π“Šπ“ƒπ’Ύπ’Έβ„΄π’Ήβ„―';
38
42 private string $input;
43
47 public function __construct( string $inputUnicode ) {
48 $this->input = $inputUnicode;
49 }
50
51 public function checkConstraint(): string {
52 if ( $this->input === self::VALID_UNICODE ) {
53 return self::CONSTRAINT_PASSED;
54 }
55 return self::CONSTRAINT_FAILED;
56 }
57
58 public function getLegacyStatus(): StatusValue {
59 $statusValue = StatusValue::newGood();
60 if ( $this->input !== self::VALID_UNICODE ) {
61 $statusValue->fatal( 'unicode-support-fail' );
62 $statusValue->value = self::AS_UNICODE_NOT_SUPPORTED;
63 }
64 return $statusValue;
65 }
66
67}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
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.