trimmed comment bloat. returning boolean on eloquent save.

This commit is contained in:
Taylor Otwell
2011-06-10 12:43:09 -05:00
parent b66be283d4
commit f7bb0c5510
43 changed files with 178 additions and 730 deletions

View File

@@ -12,9 +12,6 @@ class Text {
*/
public static function words($value, $limit, $end = '…')
{
// -----------------------------------------------------
// If the value is an empty string, bail out.
// -----------------------------------------------------
if (trim($value) == '')
{
return $value;
@@ -34,9 +31,6 @@ class Text {
$end = '';
}
// -----------------------------------------------------
// Add the ending character to the string.
// -----------------------------------------------------
return rtrim($matches[0]).$end;
}
@@ -50,9 +44,6 @@ class Text {
*/
public static function characters($value, $limit, $end = '…')
{
// -----------------------------------------------------
// If the value does not exceed the limit, bail out.
// -----------------------------------------------------
if (strlen($value) < $limit)
{
return $value;
@@ -63,17 +54,11 @@ class Text {
// -----------------------------------------------------
$value = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $value));
// -----------------------------------------------------
// If the value does not exceed the limit, bail out.
// -----------------------------------------------------
if (strlen($value) <= $limit)
{
return $value;
}
// -----------------------------------------------------
// Initialize the output string.
// -----------------------------------------------------
$out = '';
// -----------------------------------------------------
@@ -82,24 +67,12 @@ class Text {
// -----------------------------------------------------
foreach (explode(' ', trim($value)) as $val)
{
// -----------------------------------------------------
// Add the word to the output.
// -----------------------------------------------------
$out .= $val.' ';
// -----------------------------------------------------
// Check the output length.
// -----------------------------------------------------
if (strlen($out) >= $limit)
{
// -----------------------------------------------------
// Trim the output.
// -----------------------------------------------------
$out = trim($out);
// -----------------------------------------------------
// Add the ending character to the string.
// -----------------------------------------------------
return (strlen($out) == strlen($value)) ? $out : $out.$end;
}
}
@@ -115,9 +88,6 @@ class Text {
*/
public static function censor($value, $censored, $replacement = '####')
{
// -----------------------------------------------------
// Pad the value with spaces.
// -----------------------------------------------------
$value = ' '.$value.' ';
// -----------------------------------------------------