8000 Slightly re-design the debugging toolbar. by shiroyuki · Pull Request #3833 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Slightly re-design the debugging toolbar. #3833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0c9b2d4
use SecurityContextInterface instead of SecurityContext
Mar 9, 2012
5ede111
merged branch pminnieur/2.0 (PR #3537)
fabpot Mar 23, 2012
86a3512
[FrameworkBundle] Add support for full URLs to redirect controller
Seldaek Mar 25, 2012
42b8c7a
merged branch Seldaek/redirect (PR #3693)
fabpot Mar 26, 2012
15dd17e
Simplified CONTENT_ headers retrieval
jalliot Mar 26, 2012
51eac4b
merged branch jalliot/header-bag (PR #3702)
fabpot Mar 27, 2012
e4f3fd9
Fixed example code.
clemens-tolboom Mar 29, 2012
d12e398
merged branch clemens-tolboom/2.0 (PR #3725)
fabpot Mar 29, 2012
24a0d0a
[DependencyInjection] Support Yaml calls without arguments
igorw Mar 31, 2012
a10fee1
merged branch igorw/dic-yaml-without-args (PR #3747)
fabpot Apr 1, 2012
032ab94
Prepare for modifying toolbar.
Apr 3, 2012
fd1ea69
[Security] [HttpDigest] Fixes a configuration error caused by an inva…
Apr 4, 2012
eb6a26f
merged branch ruimarinho/http_digest (PR #3778)
fabpot Apr 4, 2012
e4ebffb
Revert "merged branch ruimarinho/http_digest (PR #3778)"
fabpot Apr 4, 2012
fc41d4f
[Security] [HttpDigest] Fixes a configuration error caused by an inva…
Apr 4, 2012
f7647f9
[Routing] improved exception message when giving an invalid route name.
Apr 6, 2012
04ae7cc
[Routing] fixed exception message.
Apr 6, 2012
97f7b29
[Console] Avoid outputing \r's in exception messages
Seldaek Apr 6, 2012
595cc11
[Console] Wrap exception messages to the terminal width to avoid ugly…
Seldaek Apr 6, 2012
c140386
merged branch ruimarinho/http_digest (PR #3781)
fabpot Apr 6, 2012
f2398f6
merged branch Seldaek/console_ex_20 (PR #3802)
fabpot Apr 6, 2012
1387415
merged branch hhamon/route_collection_better_exception_message (PR #3…
fabpot Apr 6, 2012
cfd993b
Merge branch '2.0' of http://github.com/symfony/symfony into 2.0
shiroyuki Apr 6, 2012
8a2b115
[Console] Mock terminal size to prevent formatting errors on small te…
Seldaek Apr 6, 2012
7ce22f0
[Console] Add docblocks
Seldaek Apr 6, 2012
38e17c2
merged branch Seldaek/termwidth (PR #3805)
fabpot Apr 6, 2012
6bd64b5
Reverted the position.
shiroyuki Apr 7, 2012
420e00b
Revamped the profiler toolbar in both embedded mode and normal.
shiroyuki Apr 7, 2012
3a202a2
Merge branch '2.0' of http://github.com/symfony/symfony into 2.0
shiroyuki Apr 7, 2012
d6a2938
minor update to the toolbar.
shiroyuki Apr 8, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions
Original file line number Diff line number Diff line change
Expand Up @@ -733,13 +733,16 @@ public function renderException($e, $output)
do {
$title = sprintf(' [%s] ', get_class($e));
$len = $strlen($title);
$width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
$lines = array();
foreach (explode("\n", $e->getMessage()) as $line) {
$lines[] = sprintf(' %s ', $line);
$len = max($strlen($line) + 4, $len);
foreach (preg_split("{\r?\n}", $e->getMessage()) as $line) {
foreach (str_split($line, $width - 4) as $line) {
$lines[] = sprintf(' %s ', $line);
$len = max($strlen($line) + 4, $len);
}
}

$messages = array(str_repeat(' ', $len), $title.str_repeat(' ', $len - $strlen($title)));
$messages = array(str_repeat(' ', $len), $title.str_repeat(' ', max(0, $len - $strlen($title))));

foreach ($lines as $line) {
$messages[] = $line.str_repeat(' ', $len - $strlen($line));
Expand Down Expand Up @@ -786,6 +789,28 @@ public function renderException($e, $output)
}
}

protected function getTerminalWidth()
{
if (defined('PHP_WINDOWS_VERSION_BUILD') && $ansicon = getenv('ANSICON')) {
return preg_replace('{^(\d+)x.*$}', '$1', $ansicon);
}

if (preg_match("{rows.(\d+);.columns.(\d+);}i", exec('stty -a | grep columns'), $match)) {
return $match[1];
}
}

protected function getTerminalHeight()
{
if (defined('PHP_WINDOWS_VERSION_BUILD') && $ansicon = getenv('ANSICON')) {
return preg_replace('{^\d+x\d+ \(\d+x(\d+)\)$}', '$1', trim($ansicon));
}

if (preg_match("{rows.(\d+);.columns.(\d+);}i", exec('stty -a | grep columns'), $match)) {
return $match[2];
}
}

/**
* Gets the name of the command based on input.
*
Expand Down
9 changes: 9 additions & 0 deletions tests/Symfony/Tests/Component/Console/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ public function testRenderException()
$tester->run(array('command' => 'foo3:bar'), array('decorated' => false));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $this->normalize($tester->getDisplay()), '->renderException() renders a pretty exceptions with previous exceptions');

$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
$application->setAutoExit(false);
$application->expects($this->any())
->method('getTerminalWidth')
->will($this->returnValue(32));
$tester = new ApplicationTester($application);

$tester->run(array('command' => 'foo'), array('decorated' => false));
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $this->normalize($tester->getDisplay()), '->renderException() wraps messages when they are bigger than the terminal');
}

public function testRun()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@



[InvalidArgumentException]
Command "foo" is not define
d.



0