| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function fake(array $mapping) |
||
| 37 | { |
||
| 38 | $collection = $this->bag->getCollection($mapping['targetEntity']); |
||
| 39 | |||
| 40 | if (0 === $collection->count()) { |
||
| 41 | throw new \Exception(sprintf('There is no record for "%s"', $mapping['targetEntity'])); |
||
| 42 | } |
||
| 43 | |||
| 44 | $records = array_values($collection->all()); |
||
| 45 | |||
| 46 | return $records[array_rand($records)]->getEntity(); |
||
| 47 | } |
||
| 54 |