public function visitGeneratorInjector(CompositeInterface $composite) { $seed = null; if ($composite instanceof SchemaNode) { # use the schema setting or keep the default global if ($composite->hasOption('randomGenerator') === true) { if ($composite->hasOption('generatorSeed') === true) { $seed = $composite->getOption('generatorSeed'); } # re-assign the global $this->headGenerator = $this->factory->create($composite->getOption('randomGenerator'), $seed); } # assign schema the default generator or the custom just setup above $composite->setGenerator($this->headGenerator); } else { # use the schema setting or keep the default global if ($composite->hasOption('randomGenerator') === true) { if ($composite->hasOption('generatorSeed') === true) { $seed = $composite->getOption('generatorSeed'); } # re-assign the global $this->headGenerator = $this->factory->create($composite->getOption('randomGenerator'), $seed); } else { $this->headGenerator = $composite->getParent()->getGenerator(); } # re-assign the global $composite->setGenerator($this->headGenerator); } }