1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-05 04:47:33 +02:00

Update alignment in phpdocs

This commit is contained in:
Daniel St. Jules
2017-03-13 23:10:57 -04:00
parent 5c50a58bb8
commit 3708b6ba90

View File

@@ -62,8 +62,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* then returns the initialized object. Throws an InvalidArgumentException * then returns the initialized object. Throws an InvalidArgumentException
* if the first argument is an array or object without a __toString method. * if the first argument is an array or object without a __toString method.
* *
* @param mixed $str Value to modify, after being cast to string * @param mixed $str Value to modify, after being cast to string
* @param string $encoding The character encoding * @param string $encoding The character encoding
* @return static A Stringy object * @return static A Stringy object
* @throws \InvalidArgumentException if an array or object without a * @throws \InvalidArgumentException if an array or object without a
* __toString method is passed as the first argument * __toString method is passed as the first argument
@@ -86,7 +86,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns a new string with $string appended. * Returns a new string with $string appended.
* *
* @param string $string The string to append * @param string $string The string to append
* @return static Object with appended $string * @return static Object with appended $string
*/ */
public function append($string) public function append($string)
@@ -97,7 +97,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns the character at $index, with indexes starting at 0. * Returns the character at $index, with indexes starting at 0.
* *
* @param int $index Position of the character * @param int $index Position of the character
* @return static The character at $index * @return static The character at $index
*/ */
public function at($index) public function at($index)
@@ -219,9 +219,9 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* default the comparison is case-sensitive, but can be made insensitive by * default the comparison is case-sensitive, but can be made insensitive by
* setting $caseSensitive to false. * setting $caseSensitive to false.
* *
* @param string[] $needles Substrings to look for * @param string[] $needles Substrings to look for
* @param bool $caseSensitive Whether or not to enforce case-sensitivity * @param bool $caseSensitive Whether or not to enforce case-sensitivity
* @return bool Whether or not $str contains $needle * @return bool Whether or not $str contains $needle
*/ */
public function containsAll($needles, $caseSensitive = true) public function containsAll($needles, $caseSensitive = true)
{ {
@@ -311,7 +311,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* of the first character of the string), and in place of spaces, dashes, * of the first character of the string), and in place of spaces, dashes,
* and underscores. Alpha delimiters are not converted to lowercase. * and underscores. Alpha delimiters are not converted to lowercase.
* *
* @param string $delimiter Sequence used to separate parts of the string * @param string $delimiter Sequence used to separate parts of the string
* @return static Object with a delimited $str * @return static Object with a delimited $str
*/ */
public function delimit($delimiter) public function delimit($delimiter)
@@ -382,7 +382,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Ensures that the string begins with $substring. If it doesn't, it's * Ensures that the string begins with $substring. If it doesn't, it's
* prepended. * prepended.
* *
* @param string $substring The substring to add if not present * @param string $substring The substring to add if not present
* @return static Object with its $str prefixed by the $substring * @return static Object with its $str prefixed by the $substring
*/ */
public function ensureLeft($substring) public function ensureLeft($substring)
@@ -400,7 +400,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Ensures that the string ends with $substring. If it doesn't, it's * Ensures that the string ends with $substring. If it doesn't, it's
* appended. * appended.
* *
* @param string $substring The substring to add if not present * @param string $substring The substring to add if not present
* @return static Object with its $str suffixed by the $substring * @return static Object with its $str suffixed by the $substring
*/ */
public function ensureRight($substring) public function ensureRight($substring)
@@ -417,7 +417,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns the first $n characters of the string. * Returns the first $n characters of the string.
* *
* @param int $n Number of characters to retrieve from the start * @param int $n Number of characters to retrieve from the start
* @return static Object with its $str being the first $n chars * @return static Object with its $str being the first $n chars
*/ */
public function first($n) public function first($n)
@@ -484,7 +484,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* http://php.net/manual/en/function.html-entity-decode.php * http://php.net/manual/en/function.html-entity-decode.php
* *
* @param int|null $flags Optional flags * @param int|null $flags Optional flags
* @return static Object with the resulting $str after being html decoded. * @return static Object with the resulting $str after being html decoded.
*/ */
public function htmlDecode($flags = ENT_COMPAT) public function htmlDecode($flags = ENT_COMPAT)
{ {
@@ -499,7 +499,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* for a list of flags. * for a list of flags.
* *
* @param int|null $flags Optional flags * @param int|null $flags Optional flags
* @return static Object with the resulting $str after being html encoded. * @return static Object with the resulting $str after being html encoded.
*/ */
public function htmlEncode($flags = ENT_COMPAT) public function htmlEncode($flags = ENT_COMPAT)
{ {
@@ -555,8 +555,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Inserts $substring into the string at the $index provided. * Inserts $substring into the string at the $index provided.
* *
* @param string $substring String to be inserted * @param string $substring String to be inserted
* @param int $index The index at which to insert the substring * @param int $index The index at which to insert the substring
* @return static Object with the resulting $str after the insertion * @return static Object with the resulting $str after the insertion
*/ */
public function insert($substring, $index) public function insert($substring, $index)
@@ -683,7 +683,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns the last $n characters of the string. * Returns the last $n characters of the string.
* *
* @param int $n Number of characters to retrieve from the end * @param int $n Number of characters to retrieve from the end
* @return static Object with its $str being the last $n chars * @return static Object with its $str being the last $n chars
*/ */
public function last($n) public function last($n)
@@ -727,7 +727,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns the longest common prefix between the string and $otherStr. * Returns the longest common prefix between the string and $otherStr.
* *
* @param string $otherStr Second string for comparison * @param string $otherStr Second string for comparison
* @return static Object with its $str being the longest common prefix * @return static Object with its $str being the longest common prefix
*/ */
public function longestCommonPrefix($otherStr) public function longestCommonPrefix($otherStr)
@@ -752,7 +752,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns the longest common suffix between the string and $otherStr. * Returns the longest common suffix between the string and $otherStr.
* *
* @param string $otherStr Second string for comparison * @param string $otherStr Second string for comparison
* @return static Object with its $str being the longest common suffix * @return static Object with its $str being the longest common suffix
*/ */
public function longestCommonSuffix($otherStr) public function longestCommonSuffix($otherStr)
@@ -778,7 +778,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns the longest common substring between the string and $otherStr. * Returns the longest common substring between the string and $otherStr.
* In the case of ties, it returns that which occurs first. * In the case of ties, it returns that which occurs first.
* *
* @param string $otherStr Second string for comparison * @param string $otherStr Second string for comparison
* @return static Object with its $str being the longest common substring * @return static Object with its $str being the longest common substring
*/ */
public function longestCommonSubstring($otherStr) public function longestCommonSubstring($otherStr)
@@ -916,9 +916,9 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* 'left', 'right', 'both') is 'right'. Throws an InvalidArgumentException * 'left', 'right', 'both') is 'right'. Throws an InvalidArgumentException
* if $padType isn't one of those 3 values. * if $padType isn't one of those 3 values.
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @param string $padType One of 'left', 'right', 'both' * @param string $padType One of 'left', 'right', 'both'
* @return static Object with a padded $str * @return static Object with a padded $str
* @throws /InvalidArgumentException If $padType isn't one of 'right', * @throws /InvalidArgumentException If $padType isn't one of 'right',
* 'left' or 'both' * 'left' or 'both'
@@ -944,8 +944,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string of a given length such that both sides of the * Returns a new string of a given length such that both sides of the
* string are padded. Alias for pad() with a $padType of 'both'. * string are padded. Alias for pad() with a $padType of 'both'.
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @return static String with padding applied * @return static String with padding applied
*/ */
public function padBoth($length, $padStr = ' ') public function padBoth($length, $padStr = ' ')
@@ -960,8 +960,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string of a given length such that the beginning of the * Returns a new string of a given length such that the beginning of the
* string is padded. Alias for pad() with a $padType of 'left'. * string is padded. Alias for pad() with a $padType of 'left'.
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @return static String with left padding * @return static String with left padding
*/ */
public function padLeft($length, $padStr = ' ') public function padLeft($length, $padStr = ' ')
@@ -973,8 +973,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string of a given length such that the end of the string * Returns a new string of a given length such that the end of the string
* is padded. Alias for pad() with a $padType of 'right'. * is padded. Alias for pad() with a $padType of 'right'.
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @return static String with right padding * @return static String with right padding
*/ */
public function padRight($length, $padStr = ' ') public function padRight($length, $padStr = ' ')
@@ -985,7 +985,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns a new string starting with $string. * Returns a new string starting with $string.
* *
* @param string $string The string to append * @param string $string The string to append
* @return static Object with appended $string * @return static Object with appended $string
*/ */
public function prepend($string) public function prepend($string)
@@ -1000,9 +1000,9 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* to a lack of support in the bundled version of Oniguruma in PHP < 5.6, * to a lack of support in the bundled version of Oniguruma in PHP < 5.6,
* and current versions of HHVM (3.8 and below). * and current versions of HHVM (3.8 and below).
* *
* @param string $pattern The regular expression pattern * @param string $pattern The regular expression pattern
* @param string $replacement The string to replace with * @param string $replacement The string to replace with
* @param string $options Matching conditions to be used * @param string $options Matching conditions to be used
* @return static Object with the resulting $str after the replacements * @return static Object with the resulting $str after the replacements
*/ */
public function regexReplace($pattern, $replacement, $options = 'msr') public function regexReplace($pattern, $replacement, $options = 'msr')
@@ -1019,7 +1019,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns a new string with the prefix $substring removed, if present. * Returns a new string with the prefix $substring removed, if present.
* *
* @param string $substring The prefix to remove * @param string $substring The prefix to remove
* @return static Object having a $str without the prefix $substring * @return static Object having a $str without the prefix $substring
*/ */
public function removeLeft($substring) public function removeLeft($substring)
@@ -1037,7 +1037,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns a new string with the suffix $substring removed, if present. * Returns a new string with the suffix $substring removed, if present.
* *
* @param string $substring The suffix to remove * @param string $substring The suffix to remove
* @return static Object having a $str without the suffix $substring * @return static Object having a $str without the suffix $substring
*/ */
public function removeRight($substring) public function removeRight($substring)
@@ -1055,7 +1055,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Returns a repeated string given a multiplier. An alias for str_repeat. * Returns a repeated string given a multiplier. An alias for str_repeat.
* *
* @param int $multiplier The number of times to repeat the string * @param int $multiplier The number of times to repeat the string
* @return static Object with a repeated str * @return static Object with a repeated str
*/ */
public function repeat($multiplier) public function repeat($multiplier)
@@ -1068,8 +1068,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Replaces all occurrences of $search in $str by $replacement. * Replaces all occurrences of $search in $str by $replacement.
* *
* @param string $search The needle to search for * @param string $search The needle to search for
* @param string $replacement The string to replace with * @param string $replacement The string to replace with
* @return static Object with the resulting $str after the replacements * @return static Object with the resulting $str after the replacements
*/ */
public function replace($search, $replacement) public function replace($search, $replacement)
@@ -1101,8 +1101,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* string is further truncated so that the substring may be appended without * string is further truncated so that the substring may be appended without
* exceeding the desired length. * exceeding the desired length.
* *
* @param int $length Desired length of the truncated string * @param int $length Desired length of the truncated string
* @param string $substring The substring to append if it can fit * @param string $substring The substring to append if it can fit
* @return static Object with the resulting $str after truncating * @return static Object with the resulting $str after truncating
*/ */
public function safeTruncate($length, $substring = '') public function safeTruncate($length, $substring = '')
@@ -1159,7 +1159,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* $replacement. The replacement defaults to a single dash, and the string * $replacement. The replacement defaults to a single dash, and the string
* is also converted to lowercase. * is also converted to lowercase.
* *
* @param string $replacement The string used to replace whitespace * @param string $replacement The string used to replace whitespace
* @return static Object whose $str has been converted to an URL slug * @return static Object whose $str has been converted to an URL slug
*/ */
public function slugify($replacement = '-') public function slugify($replacement = '-')
@@ -1229,8 +1229,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* the remaining string. If $end is negative, it is computed from the end * the remaining string. If $end is negative, it is computed from the end
* of the string. * of the string.
* *
* @param int $start Initial index from which to begin extraction * @param int $start Initial index from which to begin extraction
* @param int $end Optional index at which to end extraction * @param int $end Optional index at which to end extraction
* @return static Object with its $str being the extracted substring * @return static Object with its $str being the extracted substring
*/ */
public function slice($start, $end = null) public function slice($start, $end = null)
@@ -1253,8 +1253,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* array of Stringy objects. An optional integer $limit will truncate the * array of Stringy objects. An optional integer $limit will truncate the
* results. * results.
* *
* @param string $pattern The regex with which to split the string * @param string $pattern The regex with which to split the string
* @param int $limit Optional maximum number of results to return * @param int $limit Optional maximum number of results to return
* @return static[] An array of Stringy objects * @return static[] An array of Stringy objects
*/ */
public function split($pattern, $limit = null) public function split($pattern, $limit = null)
@@ -1317,8 +1317,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* It differs from the mb_substr() function in that providing a $length of * It differs from the mb_substr() function in that providing a $length of
* null will return the rest of the string, rather than an empty string. * null will return the rest of the string, rather than an empty string.
* *
* @param int $start Position of the first character to use * @param int $start Position of the first character to use
* @param int $length Maximum number of characters used * @param int $length Maximum number of characters used
* @return static Object with its $str being the substring * @return static Object with its $str being the substring
*/ */
public function substr($start, $length = null) public function substr($start, $length = null)
@@ -1332,7 +1332,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/** /**
* Surrounds $str with the given substring. * Surrounds $str with the given substring.
* *
* @param string $substring The substring to add to both sides * @param string $substring The substring to add to both sides
* @return static Object whose $str had the substring both prepended and * @return static Object whose $str had the substring both prepended and
* appended * appended
*/ */
@@ -1397,7 +1397,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Also accepts an array, $ignore, allowing you to list words not to be * Also accepts an array, $ignore, allowing you to list words not to be
* capitalized. * capitalized.
* *
* @param array $ignore An array of words not to capitalize * @param array $ignore An array of words not to capitalize
* @return static Object with a titleized $str * @return static Object with a titleized $str
*/ */
public function titleize($ignore = null) public function titleize($ignore = null)
@@ -1430,8 +1430,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping * en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping
* to "aeoeue" rather than "aou" as in other languages. * to "aeoeue" rather than "aou" as in other languages.
* *
* @param string $language Language of the source string * @param string $language Language of the source string
* @param bool $removeUnsupported Whether or not to remove the * @param bool $removeUnsupported Whether or not to remove the
* unsupported characters * unsupported characters
* @return static Object whose $str contains only ASCII characters * @return static Object whose $str contains only ASCII characters
*/ */
@@ -1506,7 +1506,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Converts each tab in the string to some number of spaces, as defined by * Converts each tab in the string to some number of spaces, as defined by
* $tabLength. By default, each tab is converted to 4 consecutive spaces. * $tabLength. By default, each tab is converted to 4 consecutive spaces.
* *
* @param int $tabLength Number of spaces to replace each tab with * @param int $tabLength Number of spaces to replace each tab with
* @return static Object whose $str has had tabs switched to spaces * @return static Object whose $str has had tabs switched to spaces
*/ */
public function toSpaces($tabLength = 4) public function toSpaces($tabLength = 4)
@@ -1522,7 +1522,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* defined by $tabLength, to a tab. By default, each 4 consecutive spaces * defined by $tabLength, to a tab. By default, each 4 consecutive spaces
* are converted to a tab. * are converted to a tab.
* *
* @param int $tabLength Number of spaces to replace with a tab * @param int $tabLength Number of spaces to replace with a tab
* @return static Object whose $str has had spaces switched to tabs * @return static Object whose $str has had spaces switched to tabs
*/ */
public function toTabs($tabLength = 4) public function toTabs($tabLength = 4)
@@ -1563,7 +1563,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* string. Supports the removal of unicode whitespace. Accepts an optional * string. Supports the removal of unicode whitespace. Accepts an optional
* string of characters to strip instead of the defaults. * string of characters to strip instead of the defaults.
* *
* @param string $chars Optional string of characters to strip * @param string $chars Optional string of characters to strip
* @return static Object with a trimmed $str * @return static Object with a trimmed $str
*/ */
public function trim($chars = null) public function trim($chars = null)
@@ -1578,7 +1578,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Supports the removal of unicode whitespace. Accepts an optional * Supports the removal of unicode whitespace. Accepts an optional
* string of characters to strip instead of the defaults. * string of characters to strip instead of the defaults.
* *
* @param string $chars Optional string of characters to strip * @param string $chars Optional string of characters to strip
* @return static Object with a trimmed $str * @return static Object with a trimmed $str
*/ */
public function trimLeft($chars = null) public function trimLeft($chars = null)
@@ -1593,7 +1593,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Supports the removal of unicode whitespace. Accepts an optional * Supports the removal of unicode whitespace. Accepts an optional
* string of characters to strip instead of the defaults. * string of characters to strip instead of the defaults.
* *
* @param string $chars Optional string of characters to strip * @param string $chars Optional string of characters to strip
* @return static Object with a trimmed $str * @return static Object with a trimmed $str
*/ */
public function trimRight($chars = null) public function trimRight($chars = null)
@@ -1608,8 +1608,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* truncating occurs, the string is further truncated so that the substring * truncating occurs, the string is further truncated so that the substring
* may be appended without exceeding the desired length. * may be appended without exceeding the desired length.
* *
* @param int $length Desired length of the truncated string * @param int $length Desired length of the truncated string
* @param string $substring The substring to append if it can fit * @param string $substring The substring to append if it can fit
* @return static Object with the resulting $str after truncating * @return static Object with the resulting $str after truncating
*/ */
public function truncate($length, $substring = '') public function truncate($length, $substring = '')
@@ -1851,8 +1851,8 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* For example, German will map 'ä' to 'ae', while other languages * For example, German will map 'ä' to 'ae', while other languages
* will simply return 'a'. * will simply return 'a'.
* *
* param string $language Language of the source string * @param string $language Language of the source string
* @return array An array of replacements. * @return array An array of replacements.
*/ */
protected static function langSpecificCharsArray($language = 'en') protected static function langSpecificCharsArray($language = 'en')
{ {
@@ -1884,9 +1884,9 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Adds the specified amount of left and right padding to the given string. * Adds the specified amount of left and right padding to the given string.
* The default character used is a space. * The default character used is a space.
* *
* @param int $left Length of left padding * @param int $left Length of left padding
* @param int $right Length of right padding * @param int $right Length of right padding
* @param string $padStr String used to pad * @param string $padStr String used to pad
* @return static String with padding applied * @return static String with padding applied
*/ */
protected function applyPadding($left = 0, $right = 0, $padStr = ' ') protected function applyPadding($left = 0, $right = 0, $padStr = ' ')