Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Remove method as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel committed Mar 17, 2017
1 parent 93713e7 commit 26ca2ba
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions src/Faker/Provider/Lorem.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,6 @@ public static function text($maxNbChars = 200)
throw new \InvalidArgumentException('text() can only generate text of at least 5 characters');
}

$text = static::generate($maxNbChars);

if ($maxNbChars < 25) {
// capitalize first letter
$text[0] = ucwords($text[0]);

// end sentence with full stop
$text[count($text) - 1] .= '.';
}

return implode($text, '');
}

/**
* Generate word, sentence or paragraph depending on $maxNbChars.
*
* @param integer $maxNbChars Maximum number of characters the text should contain
*
* @return array
*/
protected static function generate($maxNbChars)
{
$type = ($maxNbChars < 25) ? 'word' : (($maxNbChars < 100) ? 'sentence' : 'paragraph');

$text = array();
Expand All @@ -207,7 +185,15 @@ protected static function generate($maxNbChars)
array_pop($text);
}

return $text;
if ($type === 'word') {
// capitalize first letter
$text[0] = ucwords($text[0]);

// end sentence with full stop
$text[count($text) - 1] .= '.';
}

return implode($text, '');
}

protected static function randomizeNbElements($nbElements)
Expand Down

0 comments on commit 26ca2ba

Please sign in to comment.