HEX
Server: Apache
System: Linux webm019.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: petsclubcc (68997)
PHP: 5.4.45
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/petsclubcc/magento/setup/src/Magento/Setup/Model/Cron/MultipleStreamOutput.php
<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Setup\Model\Cron;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\Output;

/**
 * Class to allow output to multiple file streams
 */
class MultipleStreamOutput extends Output
{
    /**
     * @var array
     */
    private $streams;

    /**
     * Constructor
     *
     * @param array $streams
     * @param bool|int $verbosity
     * @param bool $decorated
     * @param OutputFormatterInterface $formatter
     */
    public function __construct(
        array $streams,
        $verbosity = self::VERBOSITY_NORMAL,
        $decorated = null,
        OutputFormatterInterface $formatter = null
    ) {
        foreach ($streams as $stream) {
            if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
                throw new \InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
            }
        }
        $this->streams = $streams;
        parent::__construct($verbosity, $decorated, $formatter);
    }

    /**
     * {@inheritdoc}
     */
    protected function doWrite($message, $newline)
    {
        foreach ($this->streams as $stream) {
            if (false === @fwrite($stream, $message . ($newline ? PHP_EOL : ''))) {
                // should never happen
                throw new \RuntimeException('Unable to write output.');
            }

            fflush($stream);
        }
    }
}