1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-13 08:44:01 +02:00

Sticking to the ruler where possible

This commit is contained in:
Daniel St. Jules
2015-02-09 21:38:42 -08:00
parent 1172a75d1e
commit b2386b6c33
2 changed files with 10 additions and 6 deletions

View File

@@ -170,7 +170,8 @@ class StaticStringy
* unless instructed otherwise. * unless instructed otherwise.
* *
* @param string $str A string with non-ASCII characters * @param string $str A string with non-ASCII characters
* @param bool $removeUnsupported Whether or not to remove the unsupported characters * @param bool $removeUnsupported Whether or not to remove the
* unsupported characters
* @return string A string containing only ASCII characters * @return string A string containing only ASCII characters
*/ */
public static function toAscii($str, $removeUnsupported = true) public static function toAscii($str, $removeUnsupported = true)

View File

@@ -422,7 +422,8 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
* replaced with their closest ASCII counterparts, and the rest are removed * replaced with their closest ASCII counterparts, and the rest are removed
* unless instructed otherwise. * unless instructed otherwise.
* *
* @param bool $removeUnsupported Whether or not to remove the unsupported characters * @param bool $removeUnsupported Whether or not to remove the
* unsupported characters
* @return Stringy Object whose $str contains only ASCII characters * @return Stringy Object whose $str contains only ASCII characters
*/ */
public function toAscii($removeUnsupported = true) public function toAscii($removeUnsupported = true)
@@ -671,8 +672,8 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
$leftPadding = mb_substr(str_repeat($padStr, ceil($left / $length)), 0, $leftPadding = mb_substr(str_repeat($padStr, ceil($left / $length)), 0,
$left, $stringy->encoding); $left, $stringy->encoding);
$rightPadding = mb_substr(str_repeat($padStr, ceil($right / $length)), 0, $rightPadding = mb_substr(str_repeat($padStr, ceil($right / $length)),
$right, $stringy->encoding); 0, $right, $stringy->encoding);
$stringy->str = $leftPadding . $stringy->str . $rightPadding; $stringy->str = $leftPadding . $stringy->str . $rightPadding;
@@ -890,7 +891,8 @@ 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 Stringy Object whose $str had the substring prepended and appended * @return Stringy Object whose $str had the substring both prepended and
* appended
*/ */
public function surround($substring) public function surround($substring)
{ {
@@ -1105,7 +1107,8 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
$len = 0; $len = 0;
$end = 0; $end = 0;
$table = array_fill(0, $strLength + 1, array_fill(0, $otherLength + 1, 0)); $table = array_fill(0, $strLength + 1,
array_fill(0, $otherLength + 1, 0));
for ($i = 1; $i <= $strLength; $i++) { for ($i = 1; $i <= $strLength; $i++) {
for ($j = 1; $j <= $otherLength; $j++) { for ($j = 1; $j <= $otherLength; $j++) {