| Total Complexity | 7 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 5 | class StringGuesser extends AbstractGuesser implements GuesserInterface |
||
| 6 | { |
||
| 7 | public function supports(array $mapping) |
||
| 8 | { |
||
| 9 | $mapping = array_merge([ 'type' => null ], $mapping); |
||
| 10 | |||
| 11 | return in_array($mapping['type'], ['string', 'text']); |
||
| 12 | } |
||
| 13 | |||
| 14 | public function transform($str, array $mapping = null) |
||
| 15 | { |
||
| 16 | return $str; |
||
| 17 | } |
||
| 18 | |||
| 19 | public function fake(array $mapping) |
||
| 20 | { |
||
| 21 | $mapping = array_merge( |
||
| 22 | ['fieldName' => null, 'type' => null], |
||
| 23 | $mapping |
||
| 24 | ); |
||
| 25 | |||
| 26 | $name = $mapping['fieldName']; |
||
| 27 | |||
| 28 | foreach ($this->fakers as $faker) { |
||
| 29 | if ($faker->isFakable($name)) { |
||
| 30 | return $faker->fake($name); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | return $this->fake(['fieldName' => 'text' === $mapping['type'] ? 'paragraph' : 'word']); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getName() |
||
| 40 | } |
||
| 41 | } |
||
| 42 |