creates a generator that produces arrays whose elements
are chosen from $gen.

@param Generator $gen
@return Generator
435219
public static function arraysOf(self $gen)
    {
        $sized = self::sized(function ($s) {
            return self::choose(0, $s);
        });
        return $sized->bindGen(function (RoseTree $numRose) use ($gen) {
            $seq = self::sequence(FP::repeat($numRose->getRoot(), $gen));
            return $seq->bindGen(function ($roses) {
                return self::pureGen(RoseTree::shrink(FP::args(), $roses));
            });
        });
    }
574014
public static function makeRandomStringGenerator($generator = null)
    {
        //No generator provided
        if (is_null($generator)) {
            //Generate default random string generator
            return static::defaultRandomStringGenerator();
        }

        //RandomStringGeneratorInterface
        if ($generator instanceof RandomStringGeneratorInterface) {
            return $generator;
        }

        // Mcrypt
        if ('mcrypt' === $generator) {
            return new McryptRandomStringGenerator();
        }

        //OpenSSL
        if ('openssl' === $generator) {
            return new OpenSslRandomStringGenerator();
        }

        //Invalid Argument
        throw new InvalidArgumentException('The random string generator must be set to "mcrypt", "openssl" or be an instance of Kunnu\Dropbox\Security\RandomStringGeneratorInterface');
    }
1068671
public function generate(GeneratorInterface $generator)
    {
        $callback = function () use ($generator) {
            $handler = Handler::create($generator);
            $handler->generate();
        };

        return $callback();
    }
1046648
public static function create($generatorType)
    {
        switch ($generatorType) {
            case ClassMetadata::GENERATOR_TYPE_ASSIGNED:
                $instance = new AssignedIdGenerator();
                break;
            case ClassMetadata::GENERATOR_TYPE_REPOSITORY:
                $instance = new RepositoryIdGenerator();
                break;
            case ClassMetadata::GENERATOR_TYPE_PARENT:
                $instance = new ParentIdGenerator();
                break;
            case ClassMetadata::GENERATOR_TYPE_AUTO:
                $instance = new AutoIdGenerator();
                break;

            default:
                throw new InvalidArgumentException("ID Generator does not exist: $generatorType");
        }

        return $instance;
    }
915586
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
    {
        $name = $input->getArgument('name');
        $generatorClass = $input->getArgument('generator-class');

        $generatorClassNameDetails = $generator->createClassNameDetails(
            $generatorClass,
            'Generator\\'
        );

        $generator->generateClass(
            $generatorClassNameDetails->getFullName(),
            __DIR__.'/../Resources/skeleton/generator/Generator.php.tpl',
            [
                'name' => $name,
            ]
        );

        $generator->writeChanges();

        $this->writeSuccessMessage($io);
    }
23184
public static function getInstance()
    {
        return new GeneratorFinderCache(
            new GeneratorFinder(
                TranstyperFactory::getInstance(),
                GeneratorValidatorFactory::getInstance(),
                new FileManager()
            ),
            Installer::getDirectories(),
            new FileManager()
        );
    }
1045787
public function getGenerator()
    {
        try {
            if (empty($this->generator)) {
                $this->setGenerator(
                    new Generator(
                        $this->config(static::TOOL_NAME),
                        $this->config(static::TOOL_ID),
                        $this->config(static::TOOL_LAUNCH_URL),
                        (empty($this->config(static::TOOL_DESCRIPTION)) ?
                            false : $this->config(static::TOOL_DESCRIPTION)),
                        (empty($this->config(static::TOOL_ICON_URL)) ?
                            false : $this->config(static::TOOL_ICON_URL)),
                        (empty($this->config(static::TOOL_LAUNCH_PRIVACY)) ?
                            LaunchPrivacy::USER_PROFILE() : $this->config(static::TOOL_LAUNCH_PRIVACY)),
                        (empty($this->config(static::TOOL_DOMAIN)) ? false : $this->config(static::TOOL_DOMAIN))
                    )
                );
            }
        } catch (LTIConfigGeneratorException $e) {
            throw new ConfigurationException(
                $e->getMessage(),
                ConfigurationException::TOOL_PROVIDER
            );
        }
        return $this->generator;
    }
338198
public static function create($type)
	{
		$generator = sprintf("Keygen\Generators\%sGenerator", ucfirst($type));

		if (class_exists($generator)) {
			$generator = new $generator;

			if ($generator instanceof Generator) {
				return $generator;
			}
		}

		throw new InvalidArgumentException('Cannot create unknown generator type.');
	}
223651
protected function generate(FileGenerator $generator)
    {
        $fqcn = $this->convertToFullQualifyClassName($this->getNameInput());

        $path = $this->getRelativePath($fqcn).'.php';

        if ($generator->exists($path)) {
            $this->error($this->type.' already exists!');

            return false;
        }

        return $this->generateFile($generator, $path, $fqcn);
    }
611050
def _make_nested_list(self, gen):
        """"""

        res = []

        for ele in gen:
            if ele is None:
                res.append(None)

            elif not is_string_like(ele) and is_generator_like(ele):
                # Nested generator
                res.append(self._make_nested_list(ele))

            else:
                res.append(ele)

        return res
798232
public static GeneratorSet basicGenerator()
    {
    GeneratorSet genSet = new GeneratorSet();
    genSet.addGenerator( GeneratorSet.ALL, new TupleGenerator());
    return genSet;
    }
1287093
public function getIterator(): \Iterator
    {
        if ($this->generator instanceof ArrayyRewindableGenerator) {
            return $this->generator;
        }

        $iterator = $this->getIteratorClass();

        if ($iterator === ArrayyIterator::class) {
            return new $iterator($this->getArray(), 0, static::class, false);
        }

        return new $iterator($this->getArray());
    }
1080069
public function getGenerator($name)
    {
        if ($this->hasGenerator($name) === false) {
            throw new \RuntimeException(sprintf('Generator not found: "%s".', $name));
        }

        return $this->generators[$name];
    }
146597
public function generate(&$result,GeneratorInterface $generator)
    {
        if($this->count() === 0) {
            throw new GeneratorException('No child scopes to call must be atleast 1');
        }
        
        $repeat_x = $this->calculateRepeatQuota($generator);
        
        # rewind the current item 
        $this->rewind();
        while($repeat_x > 0) {
            
            if($this->usingAlternatingStrategy()) {
                $randomIndex = \round($generator->generate(1,($this->count())));                
                $this->get($randomIndex)->generate($result,$generator);    
                                
            } else {
                
                foreach($this as $current) {
                    $current->generate($result,$generator);    
                }    
                
            }
            
            $repeat_x = $repeat_x -1;
        }
        
        
        return $result;
    }
394758
private static function createCollection($data, $class)
    {
        if (\is_array($data)) {
            $result = [];

            foreach ($data as $key => $value) {
                $result[$key] = self::create($value, $class);
            }

            return $result;
        }

        if ($data instanceof \Generator) {
            return self::generateResult($data, $class);
        }

        throw new \UnexpectedValueException(
            sprintf('Expected array or generator, %s given.', \gettype($data))
        );
    }
1054128
public function generate($configuration)
    {
        $generator = new Generator(
            $this->setting->getPackageDirectory(),
            $configuration
        );

        if ($generator->fileExists()) {
            echo Color::red('The configuration already exists.');

            exit(0);
        }

        $generator->write('configuration', [
            'baseNamespace' => $this->namespaces['configuration']
        ]);

        echo Color::green('The configuration was well created.');

        exit(0);
    }
1166319
public static function guess($name, Generator $generator)
    {
        $map_key = mb_strtolower($name);
        $generator_map = self::getGeneratorMap($generator);

        if (isset($generator_map[$map_key])) {
            return $generator_map[$map_key]();
        }

        return null;
    }