diff --git a/src/DataCollector/RequestCollector.php b/src/DataCollector/RequestCollector.php
index f3ae8b51..0411974d 100644
--- a/src/DataCollector/RequestCollector.php
+++ b/src/DataCollector/RequestCollector.php
@@ -261,22 +261,20 @@ protected function getRouteInformation($route)
if (isset($reflector)) {
$filename = $this->normalizeFilePath($reflector->getFileName());
+ $result['file'] = sprintf('%s:%s-%s', $filename, $reflector->getStartLine(), $reflector->getEndLine());
if ($link = $this->getXdebugLink($reflector->getFileName(), $reflector->getStartLine())) {
- $result['file'] = sprintf(
- '%s:%s-%s',
- $link['url'],
- $link['ajax'] ? 'event.preventDefault();$.ajax(this.href);' : '',
- $filename,
- $reflector->getStartLine(),
- $reflector->getEndLine()
- );
+ $result['file'] = [
+ 'value' => $result['file'],
+ 'xdebug_link' => $link,
+ ];
if (isset($result['controller']) && is_string($result['controller'])) {
- $result['controller'] .= '';
+ $result['controller'] = [
+ 'value' => $result['controller'],
+ 'xdebug_link' => $link,
+ ];
}
- } else {
- $result['file'] = sprintf('%s:%s-%s', $filename, $reflector->getStartLine(), $reflector->getEndLine());
}
}
diff --git a/src/DataCollector/RouteCollector.php b/src/DataCollector/RouteCollector.php
index f548a795..82a95302 100644
--- a/src/DataCollector/RouteCollector.php
+++ b/src/DataCollector/RouteCollector.php
@@ -91,22 +91,20 @@ protected function getRouteInformation($route)
if (isset($reflector)) {
$filename = $this->normalizeFilePath($reflector->getFileName());
+ $result['file'] = sprintf('%s:%s-%s', $filename, $reflector->getStartLine(), $reflector->getEndLine());
if ($link = $this->getXdebugLink($reflector->getFileName(), $reflector->getStartLine())) {
- $result['file'] = sprintf(
- '%s:%s-%s',
- $link['url'],
- $link['ajax'] ? 'event.preventDefault();$.ajax(this.href);' : '',
- $filename,
- $reflector->getStartLine(),
- $reflector->getEndLine()
- );
+ $result['file'] = [
+ 'value' => $result['file'],
+ 'xdebug_link' => $link,
+ ];
if (isset($result['controller'])) {
- $result['controller'] .= '';
+ $result['controller'] = [
+ 'value' => $result['controller'],
+ 'xdebug_link' => $link,
+ ];
}
- } else {
- $result['file'] = sprintf('%s:%s-%s', $filename, $reflector->getStartLine(), $reflector->getEndLine());
}
}
diff --git a/tests/DataCollector/RouteCollectorTest.php b/tests/DataCollector/RouteCollectorTest.php
index 7515b3ca..20631e4a 100644
--- a/tests/DataCollector/RouteCollectorTest.php
+++ b/tests/DataCollector/RouteCollectorTest.php
@@ -36,7 +36,7 @@ public function testItCollectsRouteUri()
/**
* @dataProvider controllerData
*/
- public function testItCollectsWithControllerHandler($controller, $file)
+ public function testItCollectsWithControllerHandler($controller, $file, $url)
{
$this->get('web/show');
@@ -45,21 +45,25 @@ public function testItCollectsWithControllerHandler($controller, $file)
$this->assertNotEmpty($collected);
$this->assertArrayHasKey('file', $collected);
$this->assertArrayHasKey('controller', $collected);
- $this->assertStringContainsString($file, $collected['file']);
- $this->assertStringContainsString($controller, $collected['controller']);
+ $this->assertStringContainsString($file, $collected['file']['value']);
+ $this->assertStringContainsString($url, $collected['file']['xdebug_link']['url']);
+ $this->assertStringContainsString($controller, $collected['controller']['value']);
+ $this->assertStringContainsString($url, $collected['controller']['xdebug_link']['url']);
}
/**
* @dataProvider viewComponentData
*/
- public function testItCollectsWithViewComponentHandler($controller, $file)
+ public function testItCollectsWithViewComponentHandler($controller, $file, $url)
{
$this->get('web/view');
$collected = $this->routeCollector->collect();
- $this->assertStringContainsString($file, $collected['file']);
- $this->assertStringContainsString($controller, $collected['controller']);
+ $this->assertStringContainsString($file, $collected['file']['value']);
+ $this->assertStringContainsString($url, $collected['file']['xdebug_link']['url']);
+ $this->assertStringContainsString($controller, $collected['controller']['value']);
+ $this->assertStringContainsString($url, $collected['controller']['xdebug_link']['url']);
}
/**
@@ -75,7 +79,7 @@ public function testItCollectsWithClosureHandler($file)
$this->assertArrayHasKey('uses', $collected);
$this->assertArrayHasKey('file', $collected);
$this->assertStringContainsString($file, $collected['uses']);
- $this->assertStringContainsString($file, $collected['file']);
+ $this->assertStringContainsString($file, $collected['file']['value']);
}
public function testItCollectsMiddleware()
@@ -93,6 +97,7 @@ public static function controllerData()
{
$filePath = urlencode(str_replace('\\', '/', realpath(__DIR__ . '/../Mocks/MockController.php')));
return [['MockController@show',
+ 'MockController.php',
sprintf('phpstorm://open?file=%s', $filePath)
]];
}
@@ -101,6 +106,7 @@ public static function viewComponentData()
{
$filePath = urlencode(str_replace('\\', '/', realpath(__DIR__ . '/../Mocks/MockViewComponent.php')));
return [['MockViewComponent@render',
+ 'MockViewComponent.php',
sprintf('phpstorm://open?file=%s', $filePath)
]];
}