Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1432421
SimpleStringComparator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
709 B
Referenced Files
None
Subscribers
None
SimpleStringComparator.php
View Options
<?php
/**
* Contains a simple string compare class.
* @license GPL-2.0-or-later
*/
namespace
MediaWiki\Extension\Translate\Utilities\StringComparators
;
/**
* A simple string comparator, that compares two strings and determines if they are an exact match.
* @since 2019.10
*/
class
SimpleStringComparator
implements
StringComparator
{
/** @inheritDoc */
public
function
getSimilarity
(
$addedMessage
,
$deletedMessage
)
{
if
(
$addedMessage
===
$deletedMessage
)
{
return
1
;
}
if
(
trim
(
mb_strtolower
(
$addedMessage
)
)
===
trim
(
mb_strtolower
(
$deletedMessage
)
)
)
{
// This is an arbitrarily chosen number to differentiate it from an exact match.
return
0.95
;
}
return
0
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 21:44 (1 d, 4 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9f/a4/b7cc5bff0bdc2a7b19a7238ebee2
Default Alt Text
SimpleStringComparator.php (709 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment