4 * @see https://github.com/laminas/laminas-stdlib for the canonical source repository
5 * @copyright https://github.com/laminas/laminas-stdlib/blob/master/COPYRIGHT.md
6 * @license https://github.com/laminas/laminas-stdlib/blob/master/LICENSE.md New BSD License
9 namespace Laminas\Stdlib\StringWrapper;
11 interface StringWrapperInterface
14 * Check if the given character encoding is supported by this wrapper
15 * and the character encoding to convert to is also supported.
17 * @param string $encoding
18 * @param string|null $convertEncoding
20 public static function isSupported($encoding, $convertEncoding = null);
23 * Get a list of supported character encodings
27 public static function getSupportedEncodings();
30 * Set character encoding working with and convert to
32 * @param string $encoding The character encoding to work with
33 * @param string|null $convertEncoding The character encoding to convert to
34 * @return StringWrapperInterface
36 public function setEncoding($encoding, $convertEncoding = null);
39 * Get the defined character encoding to work with (upper case)
43 public function getEncoding();
46 * Get the defined character encoding to convert to (upper case)
50 public function getConvertEncoding();
53 * Returns the length of the given string
58 public function strlen($str);
61 * Returns the portion of string specified by the start and length parameters
65 * @param int|null $length
66 * @return string|false
68 public function substr($str, $offset = 0, $length = null);
71 * Find the position of the first occurrence of a substring in a string
73 * @param string $haystack
74 * @param string $needle
78 public function strpos($haystack, $needle, $offset = 0);
81 * Convert a string from defined encoding to the defined convert encoding
84 * @param bool $reverse
85 * @return string|false
87 public function convert($str, $reverse = false);
90 * Wraps a string to a given number of characters
94 * @param string $break
98 public function wordWrap($str, $width = 75, $break = "\n", $cut = false);
101 * Pad a string to a certain length with another string
103 * @param string $input
104 * @param int $padLength
105 * @param string $padString
106 * @param int $padType
109 public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT);