annotate vendor/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2 /**
Chris@0 3 * Zend Framework (http://framework.zend.com/)
Chris@0 4 *
Chris@0 5 * @link http://github.com/zendframework/zf2 for the canonical source repository
Chris@0 6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
Chris@0 7 * @license http://framework.zend.com/license/new-bsd New BSD License
Chris@0 8 */
Chris@0 9
Chris@0 10 namespace Zend\Stdlib\StringWrapper;
Chris@0 11
Chris@0 12 interface StringWrapperInterface
Chris@0 13 {
Chris@0 14 /**
Chris@0 15 * Check if the given character encoding is supported by this wrapper
Chris@0 16 * and the character encoding to convert to is also supported.
Chris@0 17 *
Chris@0 18 * @param string $encoding
Chris@0 19 * @param string|null $convertEncoding
Chris@0 20 */
Chris@0 21 public static function isSupported($encoding, $convertEncoding = null);
Chris@0 22
Chris@0 23 /**
Chris@0 24 * Get a list of supported character encodings
Chris@0 25 *
Chris@0 26 * @return string[]
Chris@0 27 */
Chris@0 28 public static function getSupportedEncodings();
Chris@0 29
Chris@0 30 /**
Chris@0 31 * Set character encoding working with and convert to
Chris@0 32 *
Chris@0 33 * @param string $encoding The character encoding to work with
Chris@0 34 * @param string|null $convertEncoding The character encoding to convert to
Chris@0 35 * @return StringWrapperInterface
Chris@0 36 */
Chris@0 37 public function setEncoding($encoding, $convertEncoding = null);
Chris@0 38
Chris@0 39 /**
Chris@0 40 * Get the defined character encoding to work with (upper case)
Chris@0 41 *
Chris@0 42 * @return string
Chris@0 43 */
Chris@0 44 public function getEncoding();
Chris@0 45
Chris@0 46 /**
Chris@0 47 * Get the defined character encoding to convert to (upper case)
Chris@0 48 *
Chris@0 49 * @return string|null
Chris@0 50 */
Chris@0 51 public function getConvertEncoding();
Chris@0 52
Chris@0 53 /**
Chris@0 54 * Returns the length of the given string
Chris@0 55 *
Chris@0 56 * @param string $str
Chris@0 57 * @return int|false
Chris@0 58 */
Chris@0 59 public function strlen($str);
Chris@0 60
Chris@0 61 /**
Chris@0 62 * Returns the portion of string specified by the start and length parameters
Chris@0 63 *
Chris@0 64 * @param string $str
Chris@0 65 * @param int $offset
Chris@0 66 * @param int|null $length
Chris@0 67 * @return string|false
Chris@0 68 */
Chris@0 69 public function substr($str, $offset = 0, $length = null);
Chris@0 70
Chris@0 71 /**
Chris@0 72 * Find the position of the first occurrence of a substring in a string
Chris@0 73 *
Chris@0 74 * @param string $haystack
Chris@0 75 * @param string $needle
Chris@0 76 * @param int $offset
Chris@0 77 * @return int|false
Chris@0 78 */
Chris@0 79 public function strpos($haystack, $needle, $offset = 0);
Chris@0 80
Chris@0 81 /**
Chris@0 82 * Convert a string from defined encoding to the defined convert encoding
Chris@0 83 *
Chris@0 84 * @param string $str
Chris@0 85 * @param bool $reverse
Chris@0 86 * @return string|false
Chris@0 87 */
Chris@0 88 public function convert($str, $reverse = false);
Chris@0 89
Chris@0 90 /**
Chris@0 91 * Wraps a string to a given number of characters
Chris@0 92 *
Chris@0 93 * @param string $str
Chris@0 94 * @param int $width
Chris@0 95 * @param string $break
Chris@0 96 * @param bool $cut
Chris@0 97 * @return string
Chris@0 98 */
Chris@0 99 public function wordWrap($str, $width = 75, $break = "\n", $cut = false);
Chris@0 100
Chris@0 101 /**
Chris@0 102 * Pad a string to a certain length with another string
Chris@0 103 *
Chris@0 104 * @param string $input
Chris@0 105 * @param int $padLength
Chris@0 106 * @param string $padString
Chris@0 107 * @param int $padType
Chris@0 108 * @return string
Chris@0 109 */
Chris@0 110 public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT);
Chris@0 111 }