Iterate the samples to display.

@return \Generator
333477
public function samples()
    {
        if ($this->p()->l10n() === false) {
            $origLang = $this->lang();
            $locales  = $this->translator()->availableLocales();
            $sampleId = $this->sampleId();
            foreach ($locales as $langCode) {
                $this->setSampleId($sampleId.'_'.$langCode);
                $this->setLang($langCode);

                yield $this;
            }
            $this->setSampleId($sampleId);
            $this->setLang($origLang);
        } else {
            yield $this;
        }
    }
215971
private function seed()
    {
        foreach ($this->input as $key => $value) {
            if (!$this->call($this->before, $value, $key)) {
                return;
            }

            yield $key => $value;

            if (!$this->call($this->after, $value, $key)) {
                return;
            }
        }
    }
285366
public function getIndexes(): \Generator
    {
        $definitions = $this->reflection->getProperty('indexes') ?? [];

        foreach ($definitions as $definition) {
            yield $this->castIndex($definition);
        }
    }
768091
public function cloneBookGenerator() : \Generator {

		yield 1 => __( 'Looking up the source book', 'pressbooks' );
		if ( ! $this->setupSource() ) {
			throw new \Exception( ! empty( $_SESSION['pb_errors'][0] ) ? $_SESSION['pb_errors'][0] : __( 'Failed to setup source', 'pressbooks' ) );
		}

		// Create Book
		yield 10 => __( 'Creating the target book', 'pressbooks' );
		$this->targetBookId = $this->createBook();
		$this->targetBookUrl = get_blogaddress_by_id( $this->targetBookId );

		switch_to_blog( $this->targetBookId );
		wp_defer_term_counting( true );

		// Pre-processor
		$this->clonePreProcess();

		// Clone Metadata
		yield 20 => __( 'Cloning metadata', 'pressbooks' );
		$this->clonedItems['metadata'][] = $this->cloneMetadata();

		// Clone Taxonomy Terms
		$y = new PercentageYield( 30, 40, count( $this->sourceBookTerms ) );
		$this->targetBookTerms = $this->getBookTerms( $this->targetBookUrl );
		foreach ( $this->sourceBookTerms as $term ) {
			yield from $y->tick( __( 'Cloning contributors and licenses', 'pressbooks' ) );
			$new_term = $this->cloneTerm( $term['id'] );
			if ( $new_term ) {
				$this->termMap[ $term['id'] ] = $new_term;
				$this->clonedItems['terms'][] = $new_term;
			}
		}

		// Clone Front Matter
		$y = new PercentageYield( 40, 50, count( $this->sourceBookStructure['front-matter'] ) );
		foreach ( $this->sourceBookStructure['front-matter'] as $frontmatter ) {
			yield from $y->tick( __( 'Cloning front matter', 'pressbooks' ) );
			$new_frontmatter = $this->cloneFrontMatter( $frontmatter['id'] );
			if ( $new_frontmatter !== false ) {
				$this->clonedItems['front-matter'][] = $new_frontmatter;
			}
		}

		// Clone Parts and chapters
		$ticks = 0;
		foreach ( $this->sourceBookStructure['parts'] as $key => $part ) {
			$ticks += 1 + count( $this->sourceBookStructure['parts'][ $key ]['chapters'] );
		}
		$y = new PercentageYield( 50, 80, $ticks );
		foreach ( $this->sourceBookStructure['parts'] as $key => $part ) {
			yield from $y->tick( __( 'Cloning parts and chapters', 'pressbooks' ) );
			$new_part = $this->clonePart( $part['id'] );
			if ( $new_part !== false ) {
				$this->clonedItems['parts'][] = $new_part;
				foreach ( $this->sourceBookStructure['parts'][ $key ]['chapters'] as $chapter ) {
					yield from $y->tick( __( 'Cloning parts and chapters', 'pressbooks' ) );
					$new_chapter = $this->cloneChapter( $chapter['id'], $new_part );
					if ( $new_chapter !== false ) {
						$this->clonedItems['chapters'][] = $new_chapter;
					}
				}
			}
		}

		// Clone Back Matter
		$y = new PercentageYield( 80, 90, count( $this->sourceBookStructure['back-matter'] ) );
		foreach ( $this->sourceBookStructure['back-matter'] as $backmatter ) {
			yield from $y->tick( __( 'Cloning back matter', 'pressbooks' ) );
			$new_backmatter = $this->cloneBackMatter( $backmatter['id'] );
			if ( $new_backmatter !== false ) {
				$this->clonedItems['back-matter'][] = $new_backmatter;
			}
		}

		// Clone Glossary
		$y = new PercentageYield( 90, 100, count( $this->sourceBookGlossary ) );
		foreach ( $this->sourceBookGlossary as $glossary ) {
			yield from $y->tick( __( 'Cloning glossary terms' ) );
			$new_glossary = $this->cloneGlossary( $glossary['id'] );
			if ( $new_glossary !== false ) {
				$this->clonedItems['glossary'][] = $new_glossary;
			}
		}

		// Post-processor
		$this->clonePostProcess();

		wp_defer_term_counting( false ); // Flush
		restore_current_blog();

		yield 100 => __( 'Finishing up', 'pressbooks' );
	}
960715
public function runSample()
    {
        $this->_setupOrderReference();
        $this->_confirmOrderReference();
        $amazonAuthorizationId = $this->_performAuthorization();
        $this->_waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId);
        $this->_cancelOrder();
        $this->_getOrderReferenceDetails();
       
        print "Cancellation completed" . PHP_EOL;
    }
1157130
public function fetchParametersAsync(): \Generator
    {
        $refetchable = $this->isRefetchable();
        if ($this->fetched && !$refetchable) {
            return $this->params;
        }
        $params = yield call([$this, 'getParameters']);

        if (!$refetchable) {
            $this->params = $params;
        }

        return $params;
    }
522153
public function values(): self
    {
        return static::create(
            function () {
                /** @noinspection YieldFromCanBeUsedInspection */
                foreach ($this->getGenerator() as $value) {
                    yield $value;
                }
            },
            $this->iteratorClass,
            false
        );
    }
328218
private function themes(): Generator
    {
        $themes = $this->module_service->findByInterface(ModuleThemeInterface::class);

        // Last theme used
        yield $themes->get(Session::get('theme', ''));

        // Default for tree
        $tree = app(Tree::class);

        if ($tree instanceof Tree) {
            yield $themes->get($tree->getPreference('THEME_DIR'));
        }

        // Default for site
        yield $themes->get(Site::getPreference('THEME_DIR'));

        // Default for application
        yield app(WebtreesTheme::class);
    }
1021396
public function dump() : Generator
    {
        $nodes = [];

        $stack = [$this->root];

        while ($stack) {
            $current = array_pop($stack);

            if ($current instanceof BinaryNode) {
                foreach ($current->children() as $child) {
                    $stack[] = $child;
                }
            }

            yield $current;
        }
    }
382526
public static function fromIterator(iterable $samples) : self
    {
        $samples = is_array($samples)
            ? $samples
            : iterator_to_array($samples, false);

        return self::build($samples);
    }
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;
    }
663315
public function iterable()
    {
        $date = clone $this->getStart();

        while ($date < $this->getEnd()) {
            yield $date;
            $date->add($this->step);
        }
    }
824316
public function getIterator()
    {
        $resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod();
        foreach ($this->getResponseObject()->$resourcesGetMethod() as $element) {
            yield $element;
        }
    }
81292
protected function generateSamples(): void
    {
        $module = str_after($this->getNameInput(), '/');

        $this->call('make:config', ['name' => 'config', '--module' => $this->getNameInput()]);
        $this->call('make:model', ['name' => 'Example', '--module' => $this->getNameInput()]);
        $this->call('make:policy', ['name' => 'ExamplePolicy', '--module' => $this->getNameInput()]);
        $this->call('make:provider', ['name' => ucfirst($module).'ServiceProvider', '--module' => $this->getNameInput()]);
        $this->call('make:command', ['name' => 'ExampleCommand', '--module' => $this->getNameInput()]);
        $this->call('make:controller', ['name' => 'ExampleController', '--module' => $this->getNameInput()]);
        $this->call('make:request', ['name' => 'ExampleRequest', '--module' => $this->getNameInput()]);
        $this->call('make:middleware', ['name' => 'ExampleMiddleware', '--module' => $this->getNameInput()]);
        $this->call('make:transformer', ['name' => 'ExampleTransformer', '--model' => 'Example', '--module' => $this->getNameInput()]);
        $this->call('make:datatable', ['name' => 'ExampleDatatable', '--model' => 'Example', '--transformer' => 'ExampleTransformer', '--module' => $this->getNameInput()]);

        $this->warn('Optionally create migrations and seeds (it may take some time):');
        $this->warn("artisan make:migration create_{$module}_example_table --module {$this->getNameInput()}");
        $this->warn("artisan make:seeder ExampleSeeder --module {$this->getNameInput()}");
    }
253933
protected function findGenerators()
	{
		$generators=array();
		$n=count($this->generatorPaths);
		for($i=$n-1;$i>=0;--$i)
		{
			$alias=$this->generatorPaths[$i];
			$path=Yii::getPathOfAlias($alias);
			if($path===false || !is_dir($path))
				continue;

			$names=scandir($path);
			foreach($names as $name)
			{
				if($name[0]!=='.' && is_dir($path.'/'.$name))
				{
					$className=ucfirst($name).'Generator';
					if(is_file("$path/$name/$className.php"))
					{
						$generators[$name]=array(
							'class'=>"$alias.$name.$className",
						);
					}

					if(isset($generators[$name]) && is_dir("$path/$name/templates"))
					{
						$templatePath="$path/$name/templates";
						$dirs=scandir($templatePath);
						foreach($dirs as $dir)
						{
							if($dir[0]!=='.' && is_dir($templatePath.'/'.$dir))
								$generators[$name]['templates'][$dir]=strtr($templatePath.'/'.$dir,array('/'=>DIRECTORY_SEPARATOR,'\\'=>DIRECTORY_SEPARATOR));
						}
					}
				}
			}
		}
		return $generators;
	}
236663
public function getIterator(): Iterator
    {
        $map = $this->map;
        foreach ($map as $ordinal => $value) {
            yield ($this->enumeration)::byOrdinal($ordinal) => $value;
        }
    }
759037
public function getIterator()
    {
        $this->reset();

        foreach ($this->iterator as $key => $value) {
            $this->position++;
            yield $key => $value;
        }
    }