{@inheritDoc}

@return \Generator
1016
public function iterable()
    {
        for ($i = $this->getStart(); $i < $this->getEnd(); $i += $this->step) {
            yield $i;
        }
    }
1202781
protected function buildGeneratorWrapper()
    {
        foreach ($this->generator as $key => &$value) {
            yield null;
            $this->currentKey   = $key;
            $this->currentValue =& $value;
        }
    }
148900
private function getOverridesIterator(): \Generator
    {
        try {
            $recursiveIterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator(
                    $this->getPathToOverridesDirectory(),
                    \RecursiveDirectoryIterator::SKIP_DOTS
                ),
                \RecursiveIteratorIterator::SELF_FIRST
            );
            foreach ($recursiveIterator as $fileInfo) {
                /**
                 * @var \SplFileInfo $fileInfo
                 */
                if ($fileInfo->isFile()) {
                    if (self::OVERRIDE_EXTENSION !== substr(
                        $fileInfo->getFilename(),
                        -strlen(self::OVERRIDE_EXTENSION)
                    )
                    ) {
                        continue;
                    }
                    yield $fileInfo->getPathname();
                }
            }
        } finally {
            $recursiveIterator = null;
            unset($recursiveIterator);
        }
    }
832054
public function getIterator(): \Generator
    {
        $line = '';
        foreach ($this->readIterator as $content) {
            $parts = explode($this->delimiter, $content);
            $partCount = \count($parts);
            if ($partCount > 1) {
                foreach ($parts as $i => $part) {
                    if ($i === 0) {
                        yield $line.$part;
                        continue;
                    }

                    if ($i === $partCount - 1) {
                        $line = $part;
                        continue;
                    }
                    yield $part;
                }
                continue;
            }
            $line .= $content;
        }
        yield $line;
    }
31238
protected function getGeneratorConfig()
    {
        if ($this->generatorConfig === null) {
            $this->generatorConfig = new GeneratorConfig();
            $this->generatorConfig->setBuildProperties($this->getProject()->getProperties());
        }

        return $this->generatorConfig;
    }
1334877
public function generates(...$values): GeneratorAnswerBuilder
    {
        $builder = $this->generatorAnswerBuilderFactory->create($this);
        $this->doesWith($builder->answer(), [], true, true, false);

        foreach ($values as $index => $subValues) {
            if ($index > 0) {
                $builder->returns();

                $builder = $this->generatorAnswerBuilderFactory->create($this);
                $this->doesWith($builder->answer(), [], true, true, false);
            }

            $builder->yieldsFrom($subValues);
        }

        return $builder;
    }
205516
public static function getWrapperGenerator(array $yieldables, callable $filter)
    {
        $gens = [];
        foreach ($yieldables as $yieldable) {
            $gens[(string)$yieldable['value']] = $filter($yieldable['value']);
        }
        yield CoInterface::RETURN_WITH => (yield $gens);
        // @codeCoverageIgnoreStart
    }
962994
public function getGeneratorForModule(ModuleInterface $module)
    {
        $type       = $module->getModularType();
        $collection = $this->getRouteCollectionForType($type);

        if (array_key_exists($type, $this->generators)) {
            return $this->generators[$type];
        }

        if (null === $this->options['cache_dir']) {
            return $this->generators[$type] = new $this->options['generator_class']($collection, $this->context, $this->logger);
        }

        $cacheClass = sprintf('%s_UrlGenerator', $type);

        $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'] . '/' . $cacheClass .'.php',
            function (ConfigCacheInterface $cache) use ($cacheClass, $collection) {
                /** @var GeneratorDumperInterface $dumper */
                $dumper = new $this->options['generator_dumper_class']($collection);

                $options = [
                    'class'      => $cacheClass,
                    'base_class' => $this->options['generator_base_class'],
                ];

                $cache->write($dumper->dump($options), $collection->getResources());
            }
        );

        require_once $cache->getPath();

        return $this->generators[$type] = new $cacheClass($this->context, $this->logger);
    }
190975
public function generate(&$result,GeneratorInterface $generator)
    {
        if($this->literals->count() === 0) {
            throw new GeneratorException('There are no literals to choose from');
        }
        
       $repeat_x = $this->calculateRepeatQuota($generator);
        
        while($repeat_x > 0) {
             $randomIndex = 0;
             
             if($this->literals->count() > 1) {
                $randomIndex = \round($generator->generate(1,($this->literals->count())));        
             }
             
             $result     .= $this->literals->getAt($randomIndex);
             
             --$repeat_x;
        }
        
        return $result;
        
    }
478842
public function getGenerator()
    {
        if ($this->_generator === null) {
            $language = $this->language === null ? Yii::$app->language : $this->language;
            $this->_generator = \Faker\Factory::create(str_replace('-', '_', $language));
        }
        return $this->_generator;
    }
1246844
public static function getGeneratorElements(Generator $generator)
    {
        $elements = [];

        for (; $generator->valid(); $generator->next()) {
            $elements[] = $generator->current();
        }

        return $elements;
    }
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());
    }
320630
public function transformGenerator() : \Generator {

		do_action( 'pb_pre_export' );

		// Override footnote shortcode
		if ( ! empty( $_GET['endnotes'] ) ) {
			add_shortcode( 'footnote', [ $this, 'endnoteShortcode' ] );
		} else {
			add_shortcode( 'footnote', [ $this, 'footnoteShortcode' ] );
		}

		// ------------------------------------------------------------------------------------------------------------
		// XHTML, Start!

		$metadata = \Pressbooks\Book::getBookInformation();
		$_unused = [];

		// Set two letter language code
		if ( isset( $metadata['pb_language'] ) ) {
			list( $this->lang ) = explode( '-', $metadata['pb_language'] );
		}

		// ------------------------------------------------------------------------------------------------------------
		// Buffer for Outer XHTML

		ob_start();

		$this->echoDocType( $_unused, $_unused );

		echo "<head>\n";
		echo '<meta content="text/html; charset=UTF-8" http-equiv="content-type" />' . "\n";
		echo '<meta http-equiv="Content-Language" content="' . $this->lang . '" />' . "\n";
		echo '<meta name="generator" content="Pressbooks ' . PB_PLUGIN_VERSION . '" />' . "\n";

		$this->echoMetaData( $_unused, $metadata );

		echo '<title>' . get_bloginfo( 'name' ) . "</title>\n";

		if ( current_user_can( 'edit_posts' ) ) {
			if ( ! empty( $_GET['debug'] ) ) {
				$assets = new Assets( 'pressbooks', 'plugin' );
				$css = ( $_GET['debug'] === 'prince' ) ? $this->getLatestExportStyleUrl( 'prince' ) : false;
				$js = $assets->getPath( 'scripts/paged.polyfill.js' );
				if ( $css ) {
					echo "<link rel='stylesheet' href='$css' type='text/css' />\n";
				}
				echo "<script src='$js'></script>\n";
			}
		}

		if ( ! empty( $_GET['style'] ) ) {
			$url = ( $_GET['style'] === 'prince' ) ? $this->getLatestExportStyleUrl( 'prince' ) : false;
			if ( $url ) {
				echo "<link rel='stylesheet' href='$url' type='text/css' />\n";
			}
		}
		if ( ! empty( $_GET['script'] ) ) {
			$url = $this->getExportScriptUrl( clean_filename( $_GET['script'] ) ) . '/script.js';
			if ( $url ) {
				echo "<script src='$url' type='text/javascript'></script>\n";
			}
		}

		echo "</head>\n<body lang='{$this->lang}' ";
		if ( ! empty( $_GET['optimize-for-print'] ) ) {
			echo "class='print' ";
		}
		echo ">\n";
		$replace_token = uniqid( 'PB_REPLACE_INNER_HTML_', true );
		echo $replace_token;
		echo "\n</body>\n</html>";

		$buffer_outer_html = ob_get_clean();

		// ------------------------------------------------------------------------------------------------------------
		// Buffer for Inner XHTML

		$my_get = $_GET;
		unset( $my_get['timestamp'], $my_get['hashkey'] );
		$cache = get_transient( self::TRANSIENT );
		if ( is_array( $cache ) && isset( $cache[0] ) && $cache[0] === md5( wp_json_encode( $my_get ) ) ) {
			// The $_GET parameters haven't changed since the last request so the output will be the same
			$buffer_inner_html = $cache[1];
		} else {
			$book_contents = $this->preProcessBookContents( \Pressbooks\Book::getBookContents() );
			ob_start();

			// Before Title Page
			yield 10 => $this->generatorPrefix . __( 'Creating before title page', 'pressbooks' );
			$this->echoBeforeTitle( $book_contents, $_unused );

			// Half-title
			yield 15 => $this->generatorPrefix . __( 'Creating half title page', 'pressbooks' );
			$this->echoHalfTitle( $_unused, $_unused );

			// Cover
			yield 20 => $this->generatorPrefix . __( 'Creating cover', 'pressbooks' );
			$this->echoCover( $book_contents, $metadata );

			// Title
			yield 25 => $this->generatorPrefix . __( 'Creating title page', 'pressbooks' );
			$this->echoTitle( $book_contents, $metadata );

			// Copyright
			yield 30 => $this->generatorPrefix . __( 'Creating copyright page', 'pressbooks' );
			$this->echoCopyright( $_unused, $metadata );

			// Dedication and Epigraph (In that order!)
			yield 35 => $this->generatorPrefix . __( 'Creating dedication and epigraph', 'pressbooks' );
			$this->echoDedicationAndEpigraph( $book_contents, $_unused );

			// Table of contents
			yield 40 => $this->generatorPrefix . __( 'Creating table of contents', 'pressbooks' );
			$this->echoToc( $book_contents, $_unused );

			// Front-matter
			yield 50 => $this->generatorPrefix . __( 'Exporting front matter', 'pressbooks' );
			yield from $this->echoFrontMatterGenerator( $book_contents, $metadata );

			// Promo
			$this->createPromo( $_unused, $_unused );

			// Parts, Chapters
			yield 60 => $this->generatorPrefix . __( 'Exporting parts and chapters', 'pressbooks' );
			yield from $this->echoPartsAndChaptersGenerator( $book_contents, $metadata );

			// Back-matter
			yield 70 => $this->generatorPrefix . __( 'Exporting back matter', 'pressbooks' );
			yield from $this->echoBackMatterGenerator( $book_contents, $metadata );

			$buffer_inner_html = ob_get_clean();

			if ( $this->tidy ) {
				$buffer_inner_html = Sanitize\prettify( $buffer_inner_html );
			}

			// Put the $_GET parameters and the buffer in a transient
			set_transient( self::TRANSIENT, [ md5( wp_json_encode( $my_get ) ), $buffer_inner_html ] );
		}

		// Put inner HTML inside outer HTML
		$pos = strpos( $buffer_outer_html, $replace_token );
		$buffer = substr_replace( $buffer_outer_html, $buffer_inner_html, $pos, strlen( $replace_token ) );

		$this->transformOutput = $buffer;
	}
285366
public function getIndexes(): \Generator
    {
        $definitions = $this->reflection->getProperty('indexes') ?? [];

        foreach ($definitions as $definition) {
            yield $this->castIndex($definition);
        }
    }
603873
public function parametric() : Generator
    {
        foreach ($this->hidden as $layer) {
            if ($layer instanceof Parametric) {
                yield $layer;
            }
        }

        if ($this->output instanceof Parametric) {
            yield $this->output;
        }
    }
102363
protected function getGenerator()
    {
        $facts = new \OxidEsales\Facts\Facts();
        $unifiedNameSpaceClassMapProvider = new \OxidEsales\UnifiedNameSpaceGenerator\UnifiedNameSpaceClassMapProvider($facts);

        return new \OxidEsales\UnifiedNameSpaceGenerator\Generator($facts, $unifiedNameSpaceClassMapProvider);
    }
1023120
public function getProxyGenerator()
    {
        if (!$this->proxyGenerator) {
            $this->proxyGenerator = new ServiceProxyGenerator($this->getProxyDir(), $this->getProxyNs());
        }
        
        return $this->proxyGenerator;
    }