Source of file MockFloatField.php
Size: 0,710 Bytes - Last Modified: 2021-12-23T10:56:24+00:00
/var/www/docs.ssmods.com/process/src/code/fieldtypes/MockFloatField.php
1234567891011121314151617181920212223242526272829303132333435 | <?php /** * Defines the methods that are injected into the {@link Float} class for * generating mock data * * @package silverstripe-mock-data * @author Uncle Cheese <unclecheese@leftandmain.com> */ use Faker\Generator; class MockFloatField extends DataExtension { /** * Gets a random float value. Checks hooks for lat/long * * @param Faker\Generator * @return float */ public function getFakeData(Generator $faker) { if ($this->owner->hook("LATITUDE")) { return $faker->latitude; } if ($this->owner->hook("LONGITUDE")) { return $faker->longitude; } return mt_rand(1, 999)/mt_rand(1, 999); } } |