The Strategy#
Strategy tells DummyGenerator how to generate things. You have 4 predefined strategies ready to be used:
SimpleStrategydefault one, just generates data, no validation/checks are appliedUniqueStrategymakes sure generated data is uniqueValidStrategyallow to pass a callback validator that will check generated dataChanceStrategylet you get data with given percentage chance
For Unique and Valid strategy there is fixed amount of retries after which exception will be throws - to make sure it will not try to generate unique value forever.
Sample strategies looks like:
$simple = new SimpleStrategy();
$unique = new UniqueStrategy(retries: 500); // we have 500 retries to get unique value
$chance = new ChanceStrategy(weight: 50); // 50% chance to get value
$valid = new ValidStrategy(fn($x) => $x <= 50); // generated value has to be lower or equal than 50