This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
MultiByte.php
65 lines (59 loc) · 2.02 KB
/
MultiByte.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Text;
use Zend\Stdlib\StringUtils;
/**
* Contains multibyte safe string methods
*/
class MultiByte
{
/**
* Word wrap
*
* @param string $string
* @param int $width
* @param string $break
* @param bool $cut
* @param string $charset
* @throws Exception\InvalidArgumentException
* @return string
* @deprecated Please use Zend\Stdlib\StringUtils instead
*/
public static function wordWrap($string, $width = 75, $break = "\n", $cut = false, $charset = 'utf-8')
{
trigger_error(sprintf(
"This method is deprecated, please use '%s' instead",
'Zend\Stdlib\StringUtils::getWrapper(<charset>)->wordWrap'
), E_USER_DEPRECATED);
try {
return StringUtils::getWrapper($charset)->wordWrap($string, $width, $break, $cut);
} catch (\Zend\Stdlib\Exception\InvalidArgumentException $e) {
throw new Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
}
}
/**
* String padding
*
* @param string $input
* @param int $padLength
* @param string $padString
* @param int $padType
* @param string $charset
* @return string
* @deprecated Please use Zend\Stdlib\StringUtils instead
*/
public static function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT, $charset = 'utf-8')
{
trigger_error(sprintf(
"This method is deprecated, please use '%s' instead",
'Zend\Stdlib\StringUtils::getWrapper(<charset>)->strPad'
), E_USER_DEPRECATED);
return StringUtils::getWrapper($charset)->strPad($input, $padLength, $padString, $padType);
}
}