Writes a coverage to an ouput file.

@param  array   $options The option where the possible values are:
-`'file'` _string_: The output file name.
@return boolean
15265
public static function write($options)
    {
        $defaults = [
            'file' => null
        ];
        $options += $defaults;

        if (!$options['file']) {
            throw new RuntimeException("Missing file name");
        }

        return file_put_contents($options['file'], static::export($options));
    }
40069
public function saveIfExists(array $options = []): bool
    {
        if ($this->exists === false) {
            return false;
        }

        return $this->save($options);
    }
321613
public function sendSignal($options)
    {
        $this->outputTitle($options->title);

        $force = $this->input->getOption('force')->value;
        $all = $this->input->getOption('all')->value;

        if ($force) {
            $this->debug("'FORCE' option detected");
        }

        if ($all) {
            $this->debug("'ALL' option detected");
        }

        if (!isset($options->formatListItem)) {
            $resqueStats = $this->ResqueStats;
            $ResqueStatus = $this->ResqueStatus;
            $fresque = $this;
            $listFormatter = function ($worker) use ($resqueStats, $ResqueStatus, $fresque) {
                return sprintf(
                    '%s, started %s ago',
                    $ResqueStatus->isSchedulerWorker($worker) ? '**Scheduler Worker**' : $worker,
                    $fresque->formatDateDiff(call_user_func_array(array($resqueStats, 'getWorkerStartDate'), array($worker)))
                );
            };
        } else {
            $listFormatter = $option->formatListItem;
        }

        if (empty($options->workers)) {
            $this->output->outputLine($options->noWorkersMessage, 'failure');
        } else {
            sort($options->workers);
            $this->debug('Found ' . $options->getWorkersCount() . ' workers');

            $workerIndex = array();
            if (!$all && $options->getWorkersCount() > 1) {
                $i = 1;
                $menuItems = array();
                foreach ($options->workers as $worker) {
                    $menuItems[$i++] = $listFormatter($worker);
                }

                $menuItems['all'] = $options->allOption;

                $index = $this->getUserChoice(
                    $options->listTitle,
                    $options->selectMessage . ':',
                    $menuItems
                );

                if ($index === 'all') {
                    $workerIndex = range(1, $options->getWorkersCount());
                } else {
                    $workerIndex[] = $index;
                }

            } else {
                $workerIndex = range(1, $options->getWorkersCount());
            }

            foreach ($workerIndex as $index) {
                $worker = $options->workers[$index - 1];

                list($hostname, $pid, $queue) = explode(':', (string)$worker);

                $this->debug('Sending -' . $options->signal . ' signal to process ID ' . $pid);

                if ($this->runtime['Scheduler']['enabled'] === true && $this->ResqueStatus->isSchedulerWorker($worker)) {
                    if (isset($options->schedulerWorkerAction)) {
                        $f = $options->schedulerWorkerAction;
                        $f($worker);
                    }
                    $this->output->outputText($options->schedulerWorkerActionMessage . ' ... ');
                } else {
                    $this->output->outputText($options->actionMessage . ' ' . $pid . ' ... ');
                }



                $killResponse = $this->kill($options->signal, $pid);
                $options->onSuccess($pid, (string)$worker);

                if ($killResponse['code'] === 0) {
                    $this->output->outputLine('Done', 'success');
                } else {
                    $this->output->outputLine($killResponse['message'], 'failure');
                }
            }
        }

        $this->output->outputLine();
    }
414647
public function write( Command $command, Option $option = NULL )
    {
        $output = PHP_EOL;
        $output .= '-----------------------------------------------------' . PHP_EOL;
        $output .= $command->name . ' ' . $command->version . PHP_EOL;
        $output .= '-----------------------------------------------------' . PHP_EOL;
        $output .= $command->copyright . PHP_EOL;
        $output .= $command->description . PHP_EOL;
        $output .= 'Support: ' . $command->supportSite . PHP_EOL;
        $output .= 'Source: ' . $command->supportSource . PHP_EOL;
        $output .= '-----------------------------------------------------' . PHP_EOL . PHP_EOL;

        $output .= 'Usage: ' . $this->_getUsageExample( $command );

        if ( NULL !== $option && !empty( $option->longDescription ) ) // detailed help for single option
        {
            $output .= $option->longDescription . PHP_EOL;
        }
        else // short overview of each option
        {
            $str = '';

            foreach ( $command->options as $option )
            {
                $str .= sprintf( " --%-8s (-%s) %-6s%s",
                                 $option->longCode, $option->shortCode, $option->shortDescription, PHP_EOL
                );
            }

            $output .= $str;
        }

        echo $output;
    }
384239
function output($options = null) {
		//Helpers::dompdf_debug("trace", "($options[compress])");

		// Add page text
		$this->_add_page_text();
		$this->_add_internal_links();

		$this->_place_objects();

		if ( isset($options["compress"]) && $options["compress"] == 0 ) {
			$compress = false;
		}
		else {
			$compress = true;
		}

		$this->_pdf->SetCompression($compress);

		return $this->_pdf->Output('', 'S');
	}
440881
public function outputOptions(array $options)
    {
        /* @var $output \PG\MSF\Base\Output */
        $output = $this->getContext()->getOutput();
        $status = 200;
        if ($this->verb !== 'OPTIONS') {
            $status = 405;
        }
        $output->setHeader('Allow', implode(', ', $options));
        if (!empty($output->response)) {
            $output->setContentType('application/json; charset=UTF-8');
            $output->end('', $status);
        }
    }
1061741
public function renderOutputFromHtml($html, Options $options = null)
    {
        $tmpPdfFilePath = $this->createTempFilePath(self::PDF_EXTENSION);

        $this->renderFileFromHtml($html, $tmpPdfFilePath, $options);

        return file_get_contents($tmpPdfFilePath);
    }
196261
public function save(array $options = [])
    {
        $this->attributes['slug'] = str_slug($this->attributes['name']);

        return parent::save($options);
    }
432612
public function writeFile($filePath = null, array $options = [])
    {
        $filePath = empty($filePath)
            ? $this->filePath
            : $filePath;

        $sections = (empty($options)
            ? true
            : $options[ 'sections' ]);

        $content = null;

        if ($sections) {
            foreach ($this->getArrayCopy() as $section => $data) {
                if (is_array($data)) {
                    $content .= '[' . $section . ']' . PHP_EOL;

                    foreach ($data as $key => $value) {
                        if (is_array($value)) {
                            foreach ($value as $valueChild) {
                                $content .= $key . '[] = ' . (is_numeric($valueChild)
                                        ? $valueChild
                                        : '"' . $valueChild . '"') . PHP_EOL;
                            }
                        } elseif (strpos($key, ';') !== false) {
                            $content .= '; ' . trim(ucfirst($key), ';') . ' ' . $value . PHP_EOL;
                        } elseif (empty($value)) {
                            $content .= $key . ' = ' . PHP_EOL;
                        } else {
                            $content .= $key . ' = ' . (is_numeric($value)
                                    ? $value
                                    : '"' . $value . '"') . PHP_EOL;
                        }
                    }

                    $content .= PHP_EOL;
                } elseif (strpos($section, ';') !== false) {
                    $content .= '; ' . trim(ucfirst($section), ';') . ' ' . $data . PHP_EOL;
                } elseif (empty($data)) {
                    $content .= $section . ' = ' . PHP_EOL;
                } else {
                    $content .= $section . ' = ' . (is_numeric($data)
                            ? $data
                            : '"' . $data . '"') . PHP_EOL;
                }
            }
        } else {
            foreach ($this->getArrayCopy() as $key => $value) {
                if (is_array($value)) {
                    foreach ($value as $valueChild) {
                        $content .= $key . '[] = ' . (is_numeric($valueChild)
                                ? $valueChild
                                : '"' . $valueChild . '"') . PHP_EOL;
                    }
                } elseif (strpos($key, ';') !== false) {
                    $content .= '; ' . trim(ucfirst($key), ';') . ' ' . $value . PHP_EOL;
                } elseif (empty($value)) {
                    $content .= $key . ' = ' . PHP_EOL;
                } else {
                    $content .= $key . ' = ' . (is_numeric($value)
                            ? $value
                            : '"' . $value . '"') . PHP_EOL;
                }
            }
        }

        return (new File())->write($filePath, $content);
    }
179687
public function encode(array $options = [])
    {
        $options = array_merge(
            [
                'inline'                        => 2,
                'indent'                        => 4,
                'exceptionOnInvalidType'        => false,
                'objectSupport'                 => false
            ],
            $options
        );

        return SymfonyYaml::dump(
            $this->getContents(),
            $options['inline'],
            $options['indent'],
            $options['exceptionOnInvalidType'],
            $options['objectSupport']
        );
    }
1064083
public function dump(array $options = array())
    {
        $this->document = new \DOMDocument('1.0', 'utf-8');
        $this->document->formatOutput = true;

        $container = $this->document->createElementNS('http://symfony.com/schema/dic/services', 'container');
        $container->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
        $container->setAttribute('xsi:schemaLocation', 'http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd');

        $this->addParameters($container);
        $this->addServices($container);

        $this->document->appendChild($container);
        $xml = $this->document->saveXML();
        $this->document = null;

        return $this->container->resolveEnvPlaceholders($xml);
    }
563274
public function outputHtml($html, $options = array())
    {
        $this->addHeader('Content-Type', 'text/html; charset=utf-8')
            ->addOptionalHeaders($options)
            ->sendHeaders();

        echo $html;
        exit;
    }
1181617
public function dump(array $options = array())
    {
        return array(
            'listeners'       => $this->raw_listeners,
            'has_application' => null !== $this->application,
            'has_container'   => null !== $this->container,
        );
    }
697088
public function output($options = array())
    {
        if (!isset($options["compress"])) $options["compress"] = true;

        $this->_add_page_text();

        $debug = !$options['compress'];

        return $this->_pdf->output($debug);
    }
789179
public function render($options = array())
    {
        $template = $options['template'];
        $data = $options['data'];

        if (file_exists(($file = $this->templatePath.DIRECTORY_SEPARATOR.$template.'.tpl.php'))) {
            $template = file_get_contents($file);
        }
        else {
            Console::writeInfo('template '.$file.' was not found...');
        }

        return $this->renderTpl($template, $data);
    }
66087
public function writeFile($filePath = null, array $options = [])
    {
        $filePath = empty($filePath)
            ? $this->filePath
            : $filePath;

        if ($this->count()) {
            $zip = new \ZipArchive();

            if ($zip->open($filePath, \ZipArchive::CREATE)) {
                foreach ($this->getArrayCopy() as $directory => $files) {
                    if (is_array($files)) {
                        $zip->addEmptyDir($directory);
                        foreach ($files as $file) {
                            if (is_file($file)) {
                                $zip->addFile($file);
                            }
                        }
                    } elseif (is_file($files)) {
                        $zip->addFile($files);
                    }
                }

                return $zip->close();
            }
        }

        return false;
    }
852508
private function _output($options = array())
    {
        if (!isset($options["type"])) $options["type"] = "png";
        if (!isset($options["page"])) $options["page"] = 1;
        $type = strtolower($options["type"]);

        if (isset($this->_imgs[$options["page"] - 1])) {
            $img = $this->_imgs[$options["page"] - 1];
        } else {
            $img = $this->_imgs[0];
        }

        // Perform any antialiasing
        if ($this->_aa_factor != 1) {
            $dst_w = $this->_actual_width / $this->_aa_factor;
            $dst_h = $this->_actual_height / $this->_aa_factor;
            $dst = imagecreatetruecolor($dst_w, $dst_h);
            imagecopyresampled($dst, $img, 0, 0, 0, 0,
                $dst_w, $dst_h,
                $this->_actual_width, $this->_actual_height);
        } else {
            $dst = $img;
        }

        switch ($type) {
            case "jpg":
            case "jpeg":
                if (!isset($options["quality"])) {
                    $options["quality"] = 75;
                }

                imagejpeg($dst, null, $options["quality"]);
                break;
            case "png":
            default:
                imagepng($dst);
                break;
        }

        if ($this->_aa_factor != 1) {
            imagedestroy($dst);
        }
    }