mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11150] CS
PHPBB3-11150
This commit is contained in:
committed by
Tristan Darricau
parent
4617037feb
commit
718ca44a06
@@ -19,7 +19,7 @@ use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class console_io extends ConsoleIO
|
||||
class console_io extends ConsoleIO implements io_interface
|
||||
{
|
||||
use translate_composer_trait;
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
@@ -16,34 +16,35 @@ namespace phpbb\composer\io;
|
||||
class html_output_formatter extends \Composer\Console\HtmlOutputFormatter
|
||||
{
|
||||
protected static $availableForegroundColors = [
|
||||
30 => 'black',
|
||||
31 => 'red',
|
||||
32 => 'green',
|
||||
33 => 'orange',
|
||||
34 => 'blue',
|
||||
35 => 'magenta',
|
||||
36 => 'cyan',
|
||||
37 => 'white'
|
||||
];
|
||||
30 => 'black',
|
||||
31 => 'red',
|
||||
32 => 'green',
|
||||
33 => 'orange',
|
||||
34 => 'blue',
|
||||
35 => 'magenta',
|
||||
36 => 'cyan',
|
||||
37 => 'white',
|
||||
];
|
||||
|
||||
protected static $availableBackgroundColors = [
|
||||
40 => 'black',
|
||||
41 => 'red',
|
||||
42 => 'green',
|
||||
43 => 'yellow',
|
||||
44 => 'blue',
|
||||
45 => 'magenta',
|
||||
46 => 'cyan',
|
||||
47 => 'white'
|
||||
];
|
||||
40 => 'black',
|
||||
41 => 'red',
|
||||
42 => 'green',
|
||||
43 => 'yellow',
|
||||
44 => 'blue',
|
||||
45 => 'magenta',
|
||||
46 => 'cyan',
|
||||
47 => 'white',
|
||||
];
|
||||
|
||||
protected static $availableOptions = [
|
||||
1 => 'bold',
|
||||
4 => 'underscore',
|
||||
//5 => 'blink',
|
||||
//7 => 'reverse',
|
||||
//8 => 'conceal'
|
||||
];
|
||||
protected static $availableOptions
|
||||
= [
|
||||
1 => 'bold',
|
||||
4 => 'underscore',
|
||||
//5 => 'blink',
|
||||
//7 => 'reverse',
|
||||
//8 => 'conceal'
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@@ -52,7 +53,7 @@ class html_output_formatter extends \Composer\Console\HtmlOutputFormatter
|
||||
{
|
||||
$formatted = parent::format($message);
|
||||
|
||||
return preg_replace_callback("{[\033\e]\[([0-9;]+)m(.*?)[\033\e]\[[0-9;]+m}s", array($this, 'formatHtml'), $formatted);
|
||||
return preg_replace_callback("{[\033\e]\[([0-9;]+)m(.*?)[\033\e]\[[0-9;]+m}s", [$this, 'formatHtml'], $formatted);
|
||||
}
|
||||
|
||||
protected function formatHtml($matches)
|
||||
@@ -62,13 +63,13 @@ class html_output_formatter extends \Composer\Console\HtmlOutputFormatter
|
||||
{
|
||||
if (isset(self::$availableForegroundColors[$code]))
|
||||
{
|
||||
$out .= 'color:'.self::$availableForegroundColors[$code].';';
|
||||
$out .= 'color:' . self::$availableForegroundColors[$code] . ';';
|
||||
}
|
||||
elseif (isset(self::$availableBackgroundColors[$code]))
|
||||
else if (isset(self::$availableBackgroundColors[$code]))
|
||||
{
|
||||
$out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
|
||||
$out .= 'background-color:' . self::$availableBackgroundColors[$code] . ';';
|
||||
}
|
||||
elseif (isset(self::$availableOptions[$code]))
|
||||
else if (isset(self::$availableOptions[$code]))
|
||||
{
|
||||
switch (self::$availableOptions[$code])
|
||||
{
|
||||
@@ -83,6 +84,6 @@ class html_output_formatter extends \Composer\Console\HtmlOutputFormatter
|
||||
}
|
||||
}
|
||||
|
||||
return $out.'">'.$matches[2].'</span>';
|
||||
return $out . '">' . $matches[2] . '</span>';
|
||||
}
|
||||
}
|
||||
|
32
phpBB/phpbb/composer/io/io_interface.php
Normal file
32
phpBB/phpbb/composer/io/io_interface.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\composer\io;
|
||||
|
||||
use Composer\IO\ConsoleIO;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\IO\NullIO;
|
||||
use phpbb\language\language;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
interface io_interface extends IOInterface
|
||||
{
|
||||
/**
|
||||
* Returns the composer errors that occurred since the last tcall of the method.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_composer_error();
|
||||
}
|
32
phpBB/phpbb/composer/io/null_io.php
Normal file
32
phpBB/phpbb/composer/io/null_io.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\composer\io;
|
||||
|
||||
use Composer\IO\ConsoleIO;
|
||||
use Composer\IO\NullIO;
|
||||
use phpbb\language\language;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class console_io extends NullIO implements io_interface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_composer_error()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@ use phpbb\language\language;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
|
||||
class web_io extends BufferIO
|
||||
class web_io extends BufferIO implements io_interface
|
||||
{
|
||||
use translate_composer_trait;
|
||||
|
||||
|
Reference in New Issue
Block a user