Skip to content

Commit

Permalink
Merge pull request #52 from Zizaco/faker-predetermined-lengths
Browse files Browse the repository at this point in the history
Faker predetermined lengths
  • Loading branch information
scottrobertson committed Jul 6, 2014
2 parents 5530523 + da363d6 commit 3695491
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
13 changes: 1 addition & 12 deletions src/Zizaco/FactoryMuff/Kind/Integer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ class Integer extends Kind
public function generate()
{
$length = (int) $this->getOption(0, 5);

return $this->randomNumber($length);
}

private function randomNumber($length)
{
$integer = null;
for ($i = 0; $i < $length; $i++) {
$integer .= mt_rand(1, 9);
}

return (int) $integer;
return $this->faker->randomNumber($length, true);
}
}
7 changes: 1 addition & 6 deletions src/Zizaco/FactoryMuff/Kind/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ class String extends Kind
public function generate()
{
$length = $this->getOption(0, 10);

// Generate a large amount of text. The reason for this is that
// faker uses a maximum length, and not an exact length. We then substr this
$text = str_replace(' ', null, $this->faker->text($length * 3));

return substr($text, 0, $length);
return $this->faker->lexify(str_repeat('?', $length));
}
}

0 comments on commit 3695491

Please sign in to comment.