}
/**
- * @return array
+ * @return string
*/
function fallback8bitEncoding() {
return self::$dataCache->getItem( $this->mCode, 'fallback8bitEncoding' );
* @return string
*/
private function truncateInternal(
- $string, $length, $ellipsis, $adjustLength, $measureLength, $getSubstring
+ $string, $length, $ellipsis, $adjustLength, callable $measureLength, callable $getSubstring
) {
- if ( !is_callable( $measureLength ) || !is_callable( $getSubstring ) ) {
- throw new InvalidArgumentException( 'Invalid callback provided' );
- }
-
# Check if there is no need to truncate
if ( $measureLength( $string ) <= abs( $length ) ) {
return $string; // no need to truncate
}
} elseif ( $dispLen > $length && $dispLen > strlen( $ellipsis ) ) {
# String in fact does need truncation, the truncation point was OK.
+ // @phan-suppress-next-line PhanTypeInvalidExpressionArrayDestructuring
list( $ret, $openTags ) = $maybeState; // reload state
$ret = $this->removeBadCharLast( $ret ); // multi-byte char fix
$ret .= $ellipsis; // add ellipsis
return $this->mHtmlCode;
}
- /**
- * @param string $code
- * @deprecated since 1.32, use Language::factory to create a new object instead.
- */
- public function setCode( $code ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->mCode = $code;
- // Ensure we don't leave incorrect cached data lying around
- $this->mHtmlCode = null;
- $this->mParentLanguage = false;
- }
-
/**
* Get the language code from a file name. Inverse of getFileName()
* @param string $filename $prefix . $languageCode . $suffix