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
46 public function __construct( string $inputUnicode ) {
47 $this->input = $inputUnicode;
48 }
49
50 public function checkConstraint(): string {
51 if ( $this->input === self::VALID_UNICODE ) {
52 return self::CONSTRAINT_PASSED;
53 }
54 return self::CONSTRAINT_FAILED;
55 }
56
57 public function getLegacyStatus(): StatusValue {
58 $statusValue = StatusValue::newGood();
59 if ( $this->input !== self::VALID_UNICODE ) {
60 $statusValue->fatal( 'unicode-support-fail' );
61 $statusValue->value = self::AS_UNICODE_NOT_SUPPORTED;
62 }
63 return $statusValue;
64 }
65
66}
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.