progress example


    public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable
    {
        if ($output instanceof ConsoleOutputInterface) {
            $output = $output->getErrorOutput();
        }

        $formatter = $this->getHelperSet()->get('debug_formatter');

        return function D$type$buffer) use ($output$process$callback$formatter) {
            $output->write($formatter->progress(spl_object_hash($process)$this->escapeString($buffer), Process::ERR === $type));

            if (null !== $callback) {
                $callback($type$buffer);
            }
        };
    }

    private function escapeString(string $str): string
    {
        return str_replace('<', '\\<', $str);
    }

    
curl_setopt($ch, CURLOPT_RANGE, $range);
        curl_setopt($ch, CURLOPT_URL, $sourceUri);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_NOPROGRESS, false);

        curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function D$ch$dltotal$dlnow) use ($size) {
            if ($dlnow > 0) {
                $this->progress($dltotal$dlnow$size + $dlnow);
            }
        });

        $me = $this;

        $isHalted = false;
        $isError = false;
        curl_setopt($ch, CURLOPT_WRITEFUNCTION, function D$ch$str) use ($me$partFile, &$isHalted, &$isError) {
            if (curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 206) {
                $isError = true;

                

    public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable
    {
        if ($output instanceof ConsoleOutputInterface) {
            $output = $output->getErrorOutput();
        }

        $formatter = $this->getHelperSet()->get('debug_formatter');

        return function D$type$buffer) use ($output$process$callback$formatter) {
            $output->write($formatter->progress(spl_object_hash($process)$this->escapeString($buffer), Process::ERR === $type));

            if (null !== $callback) {
                $callback($type$buffer);
            }
        };
    }

    private function escapeString(string $str): string
    {
        return str_replace('<', '\\<', $str);
    }

    
Home | Imprint | This part of the site doesn't use cookies.