本文整理汇总了PHP中Dumper::removeColors方法的典型用法代码示例。如果您正苦于以下问题:PHP Dumper::removeColors方法的具体用法?PHP Dumper::removeColors怎么用?PHP Dumper::removeColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dumper
的用法示例。
在下文中一共展示了Dumper::removeColors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupColors
/**
* Configures colored output.
* @return void
*/
public static function setupColors()
{
self::$useColors = getenv(self::COLORS) !== FALSE ? (bool) getenv(self::COLORS) : PHP_SAPI === 'cli' && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE);
ob_start(function ($s) {
return Environment::$useColors ? $s : Dumper::removeColors($s);
}, PHP_VERSION_ID < 50400 ? 2 : 1);
}
示例2: setupColors
/**
* Configures colored output.
* @return void
*/
public static function setupColors()
{
self::$useColors = getenv(self::COLORS) !== FALSE ? (bool) getenv(self::COLORS) : (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE) || getenv('TERM') === 'xterm-256color';
ob_start(function ($s) {
return self::$useColors ? $s : Dumper::removeColors($s);
}, 1, FALSE);
}
示例3: setup
/**
* Configures PHP environment.
* @return void
*/
public static function setup()
{
self::$useColors = getenv(self::COLORS) !== FALSE ? (bool) getenv(self::COLORS) : PHP_SAPI === 'cli' && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE);
class_exists('Tester\\Runner\\Job');
class_exists('Tester\\Dumper');
class_exists('Tester\\Assert');
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', TRUE);
ini_set('html_errors', FALSE);
ini_set('log_errors', FALSE);
$annotations = self::getTestAnnotations();
if (isset($annotations['outputmatch']) || isset($annotations['outputmatchfile'])) {
self::$checkAssertions = FALSE;
}
set_exception_handler(array(__CLASS__, 'handleException'));
set_error_handler(function ($severity, $message, $file, $line) {
if (in_array($severity, array(E_RECOVERABLE_ERROR, E_USER_ERROR)) || ($severity & error_reporting()) === $severity) {
Environment::handleException(new \ErrorException($message, 0, $severity, $file, $line));
}
return FALSE;
});
register_shutdown_function(function () {
Assert::$onFailure = array(__CLASS__, 'handleException');
// note that Runner is unable to catch this errors in CLI & PHP 5.4.0 - 5.4.6 due PHP bug #62725
$error = error_get_last();
register_shutdown_function(function () use($error) {
if (in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
if (($error['type'] & error_reporting()) !== $error['type']) {
// show fatal errors hidden by @shutup
echo "\nFatal error: {$error['message']} in {$error['file']} on line {$error['line']}\n";
}
} elseif (Environment::$checkAssertions && !Assert::$counter) {
echo "\nError: This test forgets to execute an assertion.\n";
exit(Runner\Job::CODE_FAIL);
}
});
});
if (getenv(self::COVERAGE)) {
CodeCoverage\Collector::start(getenv(self::COVERAGE));
}
ob_start(function ($s) {
return Environment::$useColors ? $s : Dumper::removeColors($s);
}, PHP_VERSION_ID < 50400 ? 2 : 1);
}
示例4: handleException
/** @internal */
public static function handleException($e)
{
$s = self::$debugMode ? Dumper::dumpException($e) : "\nError: {$e->getMessage()}\n";
echo self::$useColors ? $s : Dumper::removeColors($s);
exit($e instanceof AssertException ? Runner\Job::CODE_FAIL : Runner\Job::CODE_ERROR);
}