-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:Zizaco/factory-muff
Conflicts: src/Zizaco/FactoryMuff/Kind.php src/Zizaco/FactoryMuff/Kind/None.php
- Loading branch information
Showing
4 changed files
with
55 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Zizaco\FactoryMuff\Kind; | ||
|
||
use Zizaco\FactoryMuff\Kind; | ||
|
||
class Generic extends Kind | ||
{ | ||
/** | ||
* We attempt to use Faker for any string passed in, if a Faker property does | ||
* not exist, then we just return the original string | ||
* @return mixed | ||
*/ | ||
public function generate() | ||
{ | ||
// Only try and use Faker when there are no spaces in the string | ||
if (! is_string($this->kind) or strpos($this->kind, ' ') !== false) { | ||
return $this->kind; | ||
} | ||
|
||
// If it fails to call it, it must not be a real thing | ||
try { | ||
return call_user_func(array($this->faker, $this->kind)); | ||
} catch (InvalidArgumentException $e) { | ||
|
||
} | ||
|
||
// Just return the literal string | ||
return $this->kind; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters