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

Text Provider ensure text starts with an uppercase letter #527 #778

Merged
merged 2 commits into from
Feb 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Faker/Provider/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ abstract class Text extends Base
protected static $separatorLen = 1;
protected $explodedText;
protected $consecutiveWords = array();
protected static $textStartsWithUppercase = true;

/**
* Generate a text string by the Markov chain algorithm.
Expand Down Expand Up @@ -127,7 +128,11 @@ protected static function strlen($text)

protected static function validStart($word)
{
return preg_match('/^\p{Lu}/u', $word);
$isValid = true;
if (self::$textStartsWithUppercase) {
$isValid = preg_match('/^\p{Lu}/u', $word);
}
return $isValid;
}

protected static function appendEnd($text)
Expand Down