$iterable * @return array */ public static function iterable_to_array( iterable $iterable ): array { // phpcs:ignore MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName,Generic.Files.LineLength.TooLong return PHPU::iterable_to_array( $iterable ); } /** * json_encode wrapper function * - unscapes slashes and unicode * * @param mixed $o * @return string */ public static function jsonEncode( $o ): string { return PHPU::jsonEncode( $o ); } /** * If a string starts with a given prefix, remove the prefix. Otherwise, * return the original string. Like preg_replace( "/^$prefix/", '', $subject ) * except about 1.14x faster in the replacement case and 2x faster in * the no-op case. * * Note: adding type declarations to the parameters adds an overhead of 3%. * The benchmark above was without type declarations. * * @param string $subject * @param string $prefix * @return string */ public static function stripPrefix( $subject, $prefix ) { return PHPU::stripPrefix( $subject, $prefix ); } /** * If a string ends with a given suffix, remove the suffix. Otherwise, * return the original string. Like preg_replace( "/$suffix$/", '', $subject ) * except faster. * * @param string $subject * @param string $suffix * @return string */ public static function stripSuffix( $subject, $suffix ) { return PHPU::stripSuffix( $subject, $suffix ); } }