Yields an estimated percentage slice of: 10 to 75

@return \Generator
@throws \Exception
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;
	}
540258
public function getCompletionPercent()
    {
        $percent = 0;

        if (($this->completed > 0) && ($this->completionTotal > 0)) {

            $percent = $this->completed / $this->completionTotal;
        }

        return $percent;
    }
188361
public function convertData()
    {
        $ver = $this->estimateVersion();
        if($ver > $this->getVersion()) {
            $this->setVersion($ver);
        }

        for(;;) {
            $bits = $this->createBitStream();

            if($bits < 0)
                return -1;

            $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
            if($ver < 0) {
                throw new Exception('WRONG VERSION');
                return -1;
            } else if($ver > $this->getVersion()) {
                $this->setVersion($ver);
            } else {
                break;
            }
        }

        return 0;
    }
996949
public function convertGenerator() : \Generator {

		yield 1 => $this->generatorPrefix . __( 'Initializing', 'pressbooks' );

		// Sanity check

		if ( empty( $this->tmpDir ) || ! is_dir( $this->tmpDir ) ) {
			$this->logError( '$this->tmpDir must be set before calling convert().' );
			throw new \Exception();
		}

		if ( empty( $this->exportStylePath ) || ! is_file( $this->exportStylePath ) ) {
			$this->logError( '$this->exportStylePath must be set before calling convert().' );
			throw new \Exception();
		}

		// Convert
		yield 2 => $this->generatorPrefix . __( 'Preparing book contents', 'pressbooks' );
		$metadata = Book::getBookInformation();
		$book_contents = $this->preProcessBookContents( Book::getBookContents() );

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

		try {

			yield 5 => $this->generatorPrefix . __( 'Creating container', 'pressbooks' );
			$this->createContainer();
			yield from $this->createOEBPSGenerator( $book_contents, $metadata );
			$this->createOPF( $book_contents, $metadata );
			$this->createNCX( $book_contents, $metadata );

		} catch ( \Exception $e ) {
			$this->logError( $e->getMessage() );
			throw new \Exception();
		}

		yield 75 => $this->generatorPrefix . __( 'Saving file to exports folder', 'pressbooks' );
		$filename = $this->timestampedFileName( $this->suffix );
		if ( ! $this->zipEpub( $filename ) ) {
			throw new \Exception();
		}
		$this->outputPath = $filename;
		yield 80 => $this->generatorPrefix . __( 'Export successful', 'pressbooks' );
	}
96886
private function browseSteps(): \Generator
    {
        $steps = $this->steps;
        ksort($steps);

        foreach ($steps as &$stepsSublist) {
            foreach ($stepsSublist as &$step) {
                yield \key($step) => \current($step);
            }
        }
    }
283635
public function getIterator()
    {
        $header = $this->getHeader();

        while ($data = $this->getNextDataSet()) {
            $headerColumns = count($header);
            $dataColumns   = count($data);

            if ($headerColumns > $dataColumns && $this->appendRowsColumns) {
                $data = array_pad($data, $headerColumns, '');
                $this->malformedStatistic['appended']++;
            } elseif ($headerColumns < $dataColumns && $this->truncateRowsColumns) {
                $data = array_slice($data, 0, $headerColumns);
                $this->malformedStatistic['truncated']++;
            } elseif ($headerColumns != $dataColumns) {
                if ($this->ignoreMalformed) {
                    $this->malformedStatistic['malformed']++;
                    continue;
                }
                throw new Exception("Count mismatch in line {$this->getLineNumber()}, expected: {$headerColumns}, got: {$dataColumns}");
            }

            $set = array_combine($header, $data);
            yield $set;
        }
    }
1057386
public function get()
    {
        //iteracja po danych
        foreach ($this->_data as $key => $item) {
            if ($this->_elapsed == 0) {
                $this->_data[$key]['percent'] = 0;
                continue;
            }
            $this->_data[$key]['percent'] = 100 * $item['elapsed'] / $this->_elapsed;
        }
        return $this->_data;
    }
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;
            }
        }
    }
1098373
public function chunk(int $length): Generator
    {
        if ($length < 1) {
            throw new Exception(sprintf('%s() expects the length to be a positive integer %d given', __METHOD__, $length));
        }

        $input_bom = $this->getInputBOM();
        $this->document->rewind();
        $this->document->fseek(strlen($input_bom));
        foreach (str_split($this->output_bom.$this->document->fread($length), $length) as $chunk) {
            yield $chunk;
        }

        while ($this->document->valid()) {
            yield $this->document->fread($length);
        }
    }
492677
public function getIterator(): \Generator
    {
        foreach ($this->sourceIterable as $content) {
            try {
                yield $this->stream->write($content);
            } catch (\InvalidArgumentException $ex) {
                throw new \RuntimeException('The iterable generated values that are not writable', 0, $ex);
            }
        }
    }
192372
public function yieldify()
    {
        foreach ($this->storage as $key => $value) {
            yield (object) [
                'value' => $value,
                'key' => $key,
                'done' => false
            ];
        }

        yield (object) [
            'value' => null,
            'key' => null,
            'done' => true
        ];
    }
777085
public function getPercentage($round = true)
    {
        if ($this->numApprovedTranslations === 0 || $this->numTranslatable === 0) {
            $result = $round ? 0 : 0.0;
        } elseif ($this->numApprovedTranslations === $this->numTranslatable) {
            $result = $round ? 100 : 100.0;
        } else {
            $result = $this->numApprovedTranslations * 100.0 / $this->numTranslatable;
            if ($round) {
                $result = max(1, min(99, (int) round($result)));
            }
        }

        return $result;
    }
717428
public function get_ratio() {
		if (!$this->output_css_plain) {
			$this->formatted();
		}
		return round((strlen($this->input_css) - strlen($this->output_css_plain)) / strlen($this->input_css), 3) * 100;
	}
1308143
public function sizes(): Generator
    {
        for ($s = clone $this->min; $s->compare($this->max) < 1; $s = $s->add($this->step)) {
            yield $s;
        }
    }
153208
public function configureSequence(): \Generator
    {
        $sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? [];
        foreach ($sequence as $item) {
            yield $this->parseSequence($item);
        }
    }
203933
public static function calculate_percentage($numerator, $denominator, $decimals = 2, $dec_point = '.', $thousands_sep = ',')
    {
        return number_format(($numerator / $denominator) * 100, $decimals, $dec_point, $thousands_sep);
    }
626396
public function getHelpfulness()
    {
        if ($this->hits + $this->misses === 0) {
            return 0.00;
        }

        return number_format(($this->hits / ($this->hits + $this->misses)) * 100, 2);
    }