-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathComposerOutput.php
More file actions
52 lines (45 loc) · 1.06 KB
/
ComposerOutput.php
File metadata and controls
52 lines (45 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace bookin\composer\api;
#use Composer\Composer;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Output\Output;
/**
* Class ComposerOutput
*
* @property string $message
* @property OutputFormatter $formatter
*/
class ComposerOutput extends Output
{
protected $message;
/**
* @return mixed
*/
public function getMessage()
{
return nl2br($this->message);
}
/**
* Empties buffer and returns its content.
*
* @return string
*/
public function fetch()
{
$message = $this->message;
$this->message = '';
return $message;
}
/**
* Writes a message to the output.
*
* @param string $message A message to write to the output
* @param bool $newline Whether to add a newline or not
*/
protected function doWrite($message, $newline)
{
if(strripos($message, \Composer\Composer::BRANCH_ALIAS_VERSION) === false){
$this->message .= ($newline?'<br>':'').$message;
}
}
}