1<?php 2 3/** 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 7 */ 8 9namespace Laminas\Stdlib\StringWrapper; 10 11interface StringWrapperInterface 12{ 13 /** 14 * Check if the given character encoding is supported by this wrapper 15 * and the character encoding to convert to is also supported. 16 * 17 * @param string $encoding 18 * @param string|null $convertEncoding 19 */ 20 public static function isSupported($encoding, $convertEncoding = null); 21 22 /** 23 * Get a list of supported character encodings 24 * 25 * @return string[] 26 */ 27 public static function getSupportedEncodings(); 28 29 /** 30 * Set character encoding working with and convert to 31 * 32 * @param string $encoding The character encoding to work with 33 * @param string|null $convertEncoding The character encoding to convert to 34 * @return StringWrapperInterface 35 */ 36 public function setEncoding($encoding, $convertEncoding = null); 37 38 /** 39 * Get the defined character encoding to work with (upper case) 40 * 41 * @return string 42 */ 43 public function getEncoding(); 44 45 /** 46 * Get the defined character encoding to convert to (upper case) 47 * 48 * @return string|null 49 */ 50 public function getConvertEncoding(); 51 52 /** 53 * Returns the length of the given string 54 * 55 * @param string $str 56 * @return int|false 57 */ 58 public function strlen($str); 59 60 /** 61 * Returns the portion of string specified by the start and length parameters 62 * 63 * @param string $str 64 * @param int $offset 65 * @param int|null $length 66 * @return string|false 67 */ 68 public function substr($str, $offset = 0, $length = null); 69 70 /** 71 * Find the position of the first occurrence of a substring in a string 72 * 73 * @param string $haystack 74 * @param string $needle 75 * @param int $offset 76 * @return int|false 77 */ 78 public function strpos($haystack, $needle, $offset = 0); 79 80 /** 81 * Convert a string from defined encoding to the defined convert encoding 82 * 83 * @param string $str 84 * @param bool $reverse 85 * @return string|false 86 */ 87 public function convert($str, $reverse = false); 88 89 /** 90 * Wraps a string to a given number of characters 91 * 92 * @param string $str 93 * @param int $width 94 * @param string $break 95 * @param bool $cut 96 * @return string 97 */ 98 public function wordWrap($str, $width = 75, $break = "\n", $cut = false); 99 100 /** 101 * Pad a string to a certain length with another string 102 * 103 * @param string $input 104 * @param int $padLength 105 * @param string $padString 106 * @param int $padType 107 * @return string 108 */ 109 public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT); 110} 111