Stackdriver Debugger Client - Class SourceLocationResolver (1.4.16)

Reference documentation and code samples for the Stackdriver Debugger Client class SourceLocationResolver.

This class handles searching for a source file in the application's source tree. A debugger breakpoint may be requested for a source path that has extra or missing folders.

Example:

$location = new SourceLocation('Debugger/src/DebuggerClient.php', 1);
$resolver = new SourceLocationResolver();
$resolvedLocation = $resolver->resolve($location);

Methods

__construct

Create a new SourceLocationResolver.

Parameter
NameDescription
includePaths string[]|null

The search paths used to find matching source files. Defaults to the configured include path for PHP.

resolve

Resolve the full path of an existing file in the application's source.

If no matching source file is found, then return null. If found, the resolved location will include the full, absolute path to the source file.

There are 3 cases for resolving a SourceLocation:

Case 1: The exact path is found

Example:

$location = new SourceLocation('Debugger/src/DebuggerClient.php', 1);
$resolver = new SourceLocationResolver();
$resolvedLocation = $resolver->resolve($location);

Case 2: There are extra folder(s) in the requested breakpoint path

Example:

$location = new SourceLocation('extra/folder/Debugger/src/DebuggerClient.php', 1);
$resolver = new SourceLocationResolver();
$resolvedLocation = $resolver->resolve($location);

Case 3: There are fewer folders in the requested breakpoint path

Example: ``` $location = new SourceLocation('src/DebuggerClient.php', 1); $resolver = new SourceLocationResolver(); $resolvedLocation = $resolver->resolve($location);

Parameter
NameDescription
location Google\Cloud\Debugger\SourceLocation

The location to resolve.

Returns
TypeDescription
Google\Cloud\Debugger\SourceLocation|null