@return string

@throws ParserRuntimeException
172002
protected function getDatabasePath() : string
    {
        $databasePath = $this->getDataDirectory() . DIRECTORY_SEPARATOR . $this->getDatabaseFileName();

        if (!$this->isFileReadable($databasePath)) {
            if (!file_exists($databasePath)) {
                throw new ParserRuntimeException(
                    "Linked database file '$databasePath' not found. Parser data need to be generated.",
                    1458898365
                );
            } else {
                throw new ParserRuntimeException("Linked database file '$databasePath' is not readable.", 1458898366);
            }
        } elseif (!is_file($databasePath)) {
            throw new ParserRuntimeException("Invalid database file name '$databasePath' in link file.", 1458898367);
        }

        return $databasePath;
    }
1272290
public function generate(): string
    {
        $namespace = $this->reflectionClass->getNamespaceName();
        $fileDirectory = \rtrim($this->directory, '/') . '/Proxy/' . \str_replace('\\', '/', $namespace);
        $fileName = $this->reflectionClass->getShortName() . 'Proxy.php';
        $filePath = $fileDirectory . '/' . $fileName;

        if (!\is_dir($fileDirectory)) {
            // Try create directory
            if (false === @\mkdir($fileDirectory, 0777, true)) {
                throw new \RuntimeException(sprintf(
                    'Could not create directory "%s" for proxy file. Maybe not rights?',
                    $fileDirectory
                ));
            }
        } else if (!\is_writable($fileDirectory)) {
            throw new \RuntimeException(sprintf(
                'Cannot write to "%s" directory for save proxy file.',
                $fileDirectory
            ));
        }

        // Create file
        if (false === @\touch($filePath)) {
            throw new \RuntimeException(sprintf(
                'Could not create file "%s" for proxy class. Maybe not rights?',
                $filePath
            ));
        }

        \file_put_contents($filePath, $this->codeGenerator->generate());

        return $filePath;
    }
900779
public function getUrlGenerator()
    {
        if (isset($this->urlGenerator)) {
            return $this->urlGenerator;
        }

        // Check if an URL Generator resolver was set.
        else if (! isset(static::$urlGeneratorResolver)) {
            throw new RuntimeException("URL Generator resolver not set on Paginator.");
        }

        return $this->urlGenerator = call_user_func(static::$urlGeneratorResolver, $this);
    }
1146553
public function getContents() : string
	{
		if (! \is_resource($this->resource))
		{
			throw new Exception\UnreadableStreamException('Stream is not resourceable');
		}

		if (! $this->isReadable())
		{
			throw new Exception\UnreadableStreamException('Stream is not readable');
		}

		$result = \stream_get_contents($this->resource);

		if (false === $result)
		{
			throw new Exception\UnreadableStreamException('Unable to read remainder of the stream');
		}

		return $result;
	}
554229
protected function getDatabaseFileName() : string
    {
        // Get database to use, saved in the link file (as symlinks are not available or only
        // with admin permissions on Windows).
        $linkFile = $this->getDataDirectory() . DIRECTORY_SEPARATOR . Parser::LINK_FILENAME;
        if ($this->isFileReadable($linkFile)) {
            return (string)file_get_contents($linkFile);
        } elseif (!file_exists($linkFile)) {
            throw new ParserRuntimeException(
                "Database link file '$linkFile' not found. Parser data need to be generated.",
                1458898368
            );
        } else {
            throw new ParserRuntimeException("Database link file '$linkFile' is not readable.", 1458898369);
        }
    }
778076
protected function getScriptPath() : string
    {
        $class = new \ReflectionClass($this->getClassName());
        $path = $class->getFileName();
        $path = preg_replace('/\.php$/', '.phtml', $path, -1, $count);

        if ($count !== 1) {
            throw new \RuntimeException('The class filename does not end with .php');
        }

        return $path;
    }
398877
public function getStubBannerFromFile()
    {
        if (null !== ($path = $this->getStubBannerPath())) {
            $path = $this->getBasePath() . DIRECTORY_SEPARATOR . $path;

            if (false === ($contents = @file_get_contents($path))) {
                $errors = error_get_last();
                if ($errors === null) {
                    $errors = array('message' => 'failed to get contents of \''.$path.'\'');
                }

                throw new RuntimeException($errors['message']);
            }

            return $contents;
        }

        return null;
    }
531205
public function getDirectory() : string
    {
        if (! is_string($this->file)) {
            throw new RuntimeException(
                'Module file to parse has not determined yet.',
                E_WARNING
            );
        }

        return dirname($this->file);
    }
408570
public function toArray()
    {
        $data = array();

        foreach ($this as $key => $value) {
            if (is_object($value)) {
                if (!is_callable(array($value, 'toArray'))) {
                    throw new RuntimeException('Object does not implement toArray() method on key: ' . $key);
                }
                $data[$key] = $value->toArray();
            } else {
                $data[$key] = $value;
            }
        }

        return $data;
    }
691647
private function formatEndpoint()
    {
        $url = '';

        if (empty($this->uri)) {
            $url = $this->config['url'];
        } elseif (str_contains($this->uri, ['http', 'https'])) {
            $url = $this->uri;
        } elseif ($this->config->has('url')) {
            $url = $this->config['url'] . $this->uri;
        }

        if (empty($url)) {
            throw new RuntimeException('Attempting to send a request before defining a URI endpoint.');
        }

        return $url;
    }
94673
public function getContents() : string
    {
        $r = false;
        $err = ($this->stream === null || $this->readable === false);

        if ($err === false) {
            $r = stream_get_contents($this->stream);
        }

        if ($err === true || $r === false) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException("Could not get contents of stream.");
            // @codeCoverageIgnoreEnd
        }

        return $r;
    }
1289670
private function parseArgs(): array
    {
        if (null === $this->options && count($this->longopts) === 0 && null === $this->userInput) {
            return $this->fixArgs($_SERVER['argv']);
        }

        if (null !== $this->userInput) {
            $this->collectOptionsFromUserInputClass();
        }

        $parseCommandLineOptions = $this->cliOptionParser;
        $parsedVars = $parseCommandLineOptions($this->options, $this->longopts);
        if (false === $parsedVars) {
            throw new \RuntimeException(
                    'Error parsing "' . join(' ', $_SERVER['argv'])
                    . '" with ' . $this->options
                    . ' and ' . join(' ', $this->longopts)
            );
        }

        return $this->fixArgs($_SERVER['argv'], $parsedVars);
    }
332663
public function getParser(string $section, bool $throwException = false)
    {
        if (!self::$parsers) {
            self::$parsers = self::loadDefaultParsers();
        }

        if (isset(self::$parsers[$section])) {
            return self::$parsers[$section];
        }

        if ($throwException) {
            throw new \RuntimeException("The section($section) formatter is not registered!", -500);
        }

        return null;
    }
637549
public function tell()
    {
        $this->valideAttach();
        if (($stream = ftell($this->stream)) === false) {
            throw new \RuntimeException('An error has occurred.');
        }

        return $stream;
    }
1324745
private function decodeString()
    {
        if ("0" === $this->getChar() && ":" != $this->getChar($this->offset + 1)) {
            throw new RuntimeException("Illegal zero-padding in string entity length declaration at offset $this->offset");
        }

        $offsetOfColon = strpos($this->source, ":", $this->offset);
        if (false === $offsetOfColon) {
            throw new RuntimeException("Unterminated string entity at offset $this->offset");
        }

        $contentLength = (int) substr($this->source, $this->offset, $offsetOfColon);
        if (($contentLength + $offsetOfColon + 1) > $this->sourceLength) {
            throw new RuntimeException("Unexpected end of string entity at offset $this->offset");
        }

        $value = substr($this->source, $offsetOfColon + 1, $contentLength);
        $this->offset = $offsetOfColon + $contentLength + 1;

        return $value;
    }
220167
public function parseData(): self
    {
        if (!is_array($this->raw_data)) {
            throw new RuntimeException('Response must be an array');
        }

        if (array_key_exists('quantity', $this->raw_data)) {
            $this->quantity = (int)$this->raw_data['quantity'];
        }

        if (array_key_exists('transaction_id', $this->raw_data)) {
            $this->transaction_id = $this->raw_data['transaction_id'];
        }

        if (array_key_exists('original_transaction_id', $this->raw_data)) {
            $this->original_transaction_id = $this->raw_data['original_transaction_id'];
        }

        if (array_key_exists('product_id', $this->raw_data)) {
            $this->product_id = $this->raw_data['product_id'];
        }

        if (array_key_exists('web_order_line_item_id', $this->raw_data)) {
            $this->web_order_line_item_id = $this->raw_data['web_order_line_item_id'];
        }

        if (array_key_exists('is_trial_period', $this->raw_data)) {
            $this->is_trial_period = filter_var($this->raw_data['is_trial_period'], FILTER_VALIDATE_BOOLEAN);
        }

        if (array_key_exists('is_in_intro_offer_period', $this->raw_data)) {
            $this->is_in_intro_offer_period = filter_var(
                $this->raw_data['is_in_intro_offer_period'],
                FILTER_VALIDATE_BOOLEAN
            );
        }

        if (array_key_exists('purchase_date_ms', $this->raw_data)) {
            $this->purchase_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['purchase_date_ms'] / 1000)
            );
        }

        if (array_key_exists('original_purchase_date_ms', $this->raw_data)) {
            $this->original_purchase_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['original_purchase_date_ms'] / 1000)
            );
        }

        if (array_key_exists('expires_date_ms', $this->raw_data)) {
            $this->expires_date = Carbon::createFromTimestampUTC((int)round($this->raw_data['expires_date_ms'] / 1000));
        } elseif (array_key_exists('expires_date', $this->raw_data) && is_numeric($this->raw_data['expires_date'])) {
            $this->expires_date = Carbon::createFromTimestampUTC(
                (int)round((int)$this->raw_data['expires_date'] / 1000)
            );
        }

        if (array_key_exists('cancellation_date_ms', $this->raw_data)) {
            $this->cancellation_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['cancellation_date_ms'] / 1000)
            );
        }

        return $this;
    }
355347
public function getStmt()
    {
        // Make sure there are no nested arrays
        if (ArrayUtils::hasAtLeastOneArrayValue($this->bindings)) {
            throw new RuntimeException('PDO bindings can not contain nested arrays');
        }

        // Build target query before bindings are cleared purely for logging purpose
        $log = str_replace(array_keys($this->bindings), array_values($this->bindings), $this->queryBuilder->getQueryString());

        // Execute it
        $stmt = $this->pdo->prepare($this->queryBuilder->getQueryString());
        $stmt->execute($this->bindings);

        // Log target query
        $this->queryLogger->add($log);

        // Clear the buffer
        $this->clear();

        return $stmt;
    }