Skip to content

Commit

Permalink
Added random integer attribute
Browse files Browse the repository at this point in the history
Attribute allows specific length to be returned using e.g
integer|8
returns 33166023
  • Loading branch information
hexnet committed Dec 10, 2013
1 parent 8721519 commit 6fca6b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Zizaco/FactoryMuff/FactoryMuff.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ private function generateAttr( $kind, $model = NULL )
}
}

if ( is_string($kind) && substr( $kind, 0, 8 ) === 'integer|' ) {
$numgen = substr( $kind, 8 );

for ( $i=0; $i<$numgen; $i++ ) {
$result .= mt_rand(0,9);
}
}

// Overwise interpret the kind and 'generate' some
// crap.
switch ( $kind ) {
Expand Down

0 comments on commit 6fca6b0

Please sign in to comment.