Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Testing;
4
 
5
use Illuminate\Support\Str;
6
use Symfony\Component\Console\Output\ConsoleOutput;
7
 
8
class ParallelConsoleOutput extends ConsoleOutput
9
{
10
    /**
11
     * The original output instance.
12
     *
13
     * @var \Symfony\Component\Console\Output\OutputInterface
14
     */
15
    protected $output;
16
 
17
    /**
18
     * The output that should be ignored.
19
     *
20
     * @var array
21
     */
22
    protected $ignore = [
23
        'Running phpunit in',
24
        'Configuration read from',
25
    ];
26
 
27
    /**
28
     * Create a new Parallel ConsoleOutput instance.
29
     *
30
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
31
     * @return void
32
     */
33
    public function __construct($output)
34
    {
35
        parent::__construct(
36
            $output->getVerbosity(),
37
            $output->isDecorated(),
38
            $output->getFormatter(),
39
        );
40
 
41
        $this->output = $output;
42
    }
43
 
44
    /**
45
     * Writes a message to the output.
46
     *
47
     * @param  string|iterable  $messages
48
     * @param  bool  $newline
49
     * @param  int  $options
50
     * @return void
51
     */
52
    public function write($messages, bool $newline = false, int $options = 0)
53
    {
54
        $messages = collect($messages)->filter(function ($message) {
55
            return ! Str::contains($message, $this->ignore);
56
        });
57
 
58
        $this->output->write($messages->toArray(), $newline, $options);
59
    }
60
}