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