MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
StreamOutput.php
Ir para a documentação deste ficheiro.
1
<?php
2
3
namespace
Symfony\Component\Console\Output
;
4
5
/*
6
* This file is part of the Symfony framework.
7
*
8
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
9
*
10
* This source file is subject to the MIT license that is bundled
11
* with this source code in the file LICENSE.
12
*/
13
27
class
StreamOutput
extends
Output
28
{
29
protected
$stream
;
30
40
public
function
__construct
(
$stream
,
$verbosity
= self::VERBOSITY_NORMAL,
$decorated
=
null
)
41
{
42
if
(!is_resource(
$stream
) ||
'stream'
!== get_resource_type(
$stream
)) {
43
throw
new \InvalidArgumentException(
'The StreamOutput class needs a stream as its first argument.'
);
44
}
45
46
$this->stream =
$stream
;
47
48
if
(
null
===
$decorated
) {
49
$decorated
= $this->
hasColorSupport
(
$decorated
);
50
}
51
52
parent::__construct(
$verbosity
,
$decorated
);
53
}
54
60
public
function
getStream
()
61
{
62
return
$this->stream
;
63
}
64
73
public
function
doWrite
($message, $newline)
74
{
75
if
(
false
=== @fwrite($this->stream, $message.($newline ? PHP_EOL :
''
))) {
76
// @codeCoverageIgnoreStart
77
// should never happen
78
throw
new \RuntimeException(
'Unable to write output.'
);
79
// @codeCoverageIgnoreEnd
80
}
81
82
flush();
83
}
84
95
protected
function
hasColorSupport
()
96
{
97
// @codeCoverageIgnoreStart
98
if
(DIRECTORY_SEPARATOR ==
'\\'
) {
99
return
false
!== getenv(
'ANSICON'
);
100
}
else
{
101
return
function_exists(
'posix_isatty'
) && @posix_isatty($this->stream);
102
}
103
// @codeCoverageIgnoreEnd
104
}
105
}
Symfony\Component\Console\Output\Output
Definição
Output.php:26
Symfony\Component\Console\Output\Output\$decorated
$decorated
Definição
Output.php:36
Symfony\Component\Console\Output\Output\$verbosity
$verbosity
Definição
Output.php:35
Symfony\Component\Console\Output\StreamOutput
Definição
StreamOutput.php:28
Symfony\Component\Console\Output\StreamOutput\getStream
getStream()
Definição
StreamOutput.php:60
Symfony\Component\Console\Output\StreamOutput\hasColorSupport
hasColorSupport()
Definição
StreamOutput.php:95
Symfony\Component\Console\Output\StreamOutput\__construct
__construct($stream, $verbosity=self::VERBOSITY_NORMAL, $decorated=null)
Definição
StreamOutput.php:40
Symfony\Component\Console\Output\StreamOutput\$stream
$stream
Definição
StreamOutput.php:29
Symfony\Component\Console\Output\StreamOutput\doWrite
doWrite($message, $newline)
Definição
StreamOutput.php:73
Symfony\Component\Console\Output
Definição
ConsoleOutput.php:3
classes
extensions
doctrine-dbal
Doctrine
Symfony
Component
Console
Output
StreamOutput.php
Gerado por
1.10.0