Changeset View
Changeset View
Standalone View
Standalone View
src/Strings/Multibyte/StringUtilities.php
Show All 23 Lines | public static function pad ( | ||||
int $padType = STR_PAD_RIGHT, | int $padType = STR_PAD_RIGHT, | ||||
string $encoding = '' | string $encoding = '' | ||||
) : string { | ) : string { | ||||
return (new StringPad) | return (new StringPad) | ||||
->setInput($input) | ->setInput($input) | ||||
->setPadLength($padLength) | ->setPadLength($padLength) | ||||
->setPadString($padString) | ->setPadString($padString) | ||||
->setPadType($padType) | ->setPadType($padType) | ||||
->setEncoding($encoding) | ->setEncoding($encoding ?: mb_internal_encoding()) | ||||
->pad(); | ->pad(); | ||||
} | } | ||||
public static function isSupportedEncoding (string $encoding) : bool { | public static function isSupportedEncoding (string $encoding) : bool { | ||||
foreach (mb_list_encodings() as $supportedEncoding) { | foreach (mb_list_encodings() as $supportedEncoding) { | ||||
if ($encoding === $supportedEncoding) { | if ($encoding === $supportedEncoding) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
} | } |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator