# CompareAction

> Compares request summaries and panel payload structure across two captured debugger snapshots.

[API reference](/docs/api/index.md) › [Debug](/docs/extensions/debug/reference/index.md) › [actions](/docs/extensions/debug/reference/actions/index.md) › CompareAction

| final class | `yii\debug\actions\CompareAction` |
| --- | --- |
| Extends | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) » [`yii\web\Action`](/docs/api/yii/web/action/index.md) » [`yii\base\Action`](/docs/api/yii/base/action/index.md) » [`yii\base\Component`](/docs/api/yii/base/component/index.md) » [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| Implements | [`yii\base\ViewContextInterface`](/docs/api/yii/base/viewcontextinterface/index.md), [`yii\base\Configurable`](/docs/api/yii/base/configurable/index.md) |
| Source | [`src/actions/CompareAction.php`](https://github.com/yii2-extensions/debug/blob/main/src/actions/CompareAction.php#L19) |

Compares request summaries and panel payload structure across two captured debugger snapshots.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-behaviors"></span>[`$behaviors`](/docs/api/yii/base/component/index.md#property-behaviors) read-only | `array<`[`yii\base\Behavior`](/docs/api/yii/base/behavior/index.md)`<static>>` | List of behaviors attached to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="property-controller"></span>[`$controller`](/docs/api/yii/base/action/index.md#property-controller) | `yii\base\T\|null` | The controller that owns this action, or `null` when the action runs standalone. via [`Module::$actionMap`](/docs/api/yii/base/module/index.md#property-actionMap) Default: `null`. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="property-debugModule"></span>[`$debugModule`](/docs/extensions/debug/reference/actions/action/index.md#property-debugModule) read-only | [`yii\debug\Module`](/docs/extensions/debug/reference/module/index.md) | Owning debug module. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="property-id"></span>[`$id`](/docs/api/yii/base/action/index.md#property-id) | `string\|null` | ID of the action; `null` between construction and dispatcher post-assignment for standalone actions resolved through [`Module::$actionMap`](/docs/api/yii/base/module/index.md#property-actionMap) or [`Module::$actionNamespace`](/docs/api/yii/base/module/index.md#property-actionNamespace). Default: `null`. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="property-manifest"></span>[`$manifest`](/docs/extensions/debug/reference/actions/action/index.md#property-manifest) read-only | `array<string, PHPForge\Debug\Storage\RequestSummary>` | Manifest entries indexed by tag. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="property-module"></span>[`$module`](/docs/api/yii/base/action/index.md#property-module) | [`yii\base\Module`](/docs/api/yii/base/module/index.md)`\|null` | The owning module, or `null` if neither a module nor a controller is attached. Available since 22.0. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="property-summary"></span>[`$summary`](/docs/extensions/debug/reference/actions/action/index.md#property-summary) | `PHPForge\Debug\Storage\RequestSummary\|null` | Summary metadata for the active debug entry, populated by [`loadData()`](/docs/extensions/debug/reference/actions/action/index.md#method-loadData). Default: `null`. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="property-uniqueId"></span>[`$uniqueId`](/docs/api/yii/base/action/index.md#property-uniqueId) read-only | `string` | The unique ID of this action among the whole application. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="property-viewPath"></span>[`$viewPath`](/docs/extensions/debug/reference/actions/action/index.md#property-viewPath) read-only | `string` | Absolute path to the debugger views. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/api/yii/base/action/index.md#method-__construct) | Constructor. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="method-__call"></span>[`__call()`](/docs/api/yii/base/component/index.md#method-__call) | Calls the named method which is not a class method. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__clone"></span>[`__clone()`](/docs/api/yii/base/component/index.md#method-__clone) | This method is called after the object is created by cloning an existing one. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__get"></span>[`__get()`](/docs/api/yii/base/component/index.md#method-__get) | Returns the value of a component property. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__isset"></span>[`__isset()`](/docs/api/yii/base/component/index.md#method-__isset) | Checks if a property is set, i.e. defined and not null. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__set"></span>[`__set()`](/docs/api/yii/base/component/index.md#method-__set) | Sets the value of a component property. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__unset"></span>[`__unset()`](/docs/api/yii/base/component/index.md#method-__unset) | Sets a component property to be null. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-attachBehavior"></span>[`attachBehavior()`](/docs/api/yii/base/component/index.md#method-attachBehavior) | Attaches a behavior to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-attachBehaviors"></span>[`attachBehaviors()`](/docs/api/yii/base/component/index.md#method-attachBehaviors) | Attaches a list of behaviors to the component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-behaviors"></span>[`behaviors()`](/docs/api/yii/base/component/index.md#method-behaviors) | Returns a list of behaviors that this component should behave as. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-canGetProperty"></span>[`canGetProperty()`](/docs/api/yii/base/component/index.md#method-canGetProperty) | Returns a value indicating whether a property can be read. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-canSetProperty"></span>[`canSetProperty()`](/docs/api/yii/base/component/index.md#method-canSetProperty) | Returns a value indicating whether a property can be set. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-className"></span>[`className()`](/docs/api/yii/base/baseobject/index.md#method-className) static | Returns the fully qualified name of this class. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-detachBehavior"></span>[`detachBehavior()`](/docs/api/yii/base/component/index.md#method-detachBehavior) | Detaches a behavior from the component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-detachBehaviors"></span>[`detachBehaviors()`](/docs/api/yii/base/component/index.md#method-detachBehaviors) | Detaches all behaviors from the component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-ensureBehaviors"></span>[`ensureBehaviors()`](/docs/api/yii/base/component/index.md#method-ensureBehaviors) | Makes sure that the behaviors declared in [`behaviors()`](/docs/api/yii/base/component/index.md#method-behaviors) are attached to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-getBehavior"></span>[`getBehavior()`](/docs/api/yii/base/component/index.md#method-getBehavior) | Returns the named behavior object. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-getBehaviors"></span>[`getBehaviors()`](/docs/api/yii/base/component/index.md#method-getBehaviors) | Returns all behaviors attached to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-getDebugModule"></span>[`getDebugModule()`](/docs/extensions/debug/reference/actions/action/index.md#method-getDebugModule) | Returns the owning debug module. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-getManifest"></span>[`getManifest()`](/docs/extensions/debug/reference/actions/action/index.md#method-getManifest) | Returns the debug entry manifest, reloading it from the log target on demand. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-getModule"></span>[`getModule()`](/docs/api/yii/base/action/index.md#method-getModule) | Returns the module that owns this action when invoked standalone. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="method-getUniqueId"></span>[`getUniqueId()`](/docs/api/yii/base/action/index.md#method-getUniqueId) | Returns the unique ID of this action among the whole application. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="method-getViewPath"></span>[`getViewPath()`](/docs/extensions/debug/reference/actions/action/index.md#method-getViewPath) | Returns the view directory shared by every debugger page. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-hasEventHandlers"></span>[`hasEventHandlers()`](/docs/api/yii/base/component/index.md#method-hasEventHandlers) | Returns a value indicating whether there is any handler attached to the named event. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-hasMethod"></span>[`hasMethod()`](/docs/api/yii/base/component/index.md#method-hasMethod) | Returns a value indicating whether a method is defined. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-hasProperty"></span>[`hasProperty()`](/docs/api/yii/base/component/index.md#method-hasProperty) | Returns a value indicating whether a property is defined for this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-init"></span>[`init()`](/docs/api/yii/base/baseobject/index.md#method-init) | Initializes the object. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-loadData"></span>[`loadData()`](/docs/extensions/debug/reference/actions/action/index.md#method-loadData) | Loads the debug entry for the given tag into every registered panel. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-off"></span>[`off()`](/docs/api/yii/base/component/index.md#method-off) | Detaches an existing event handler from this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-on"></span>[`on()`](/docs/api/yii/base/component/index.md#method-on) | Attaches an event handler to an event. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-prepareShell"></span>[`prepareShell()`](/docs/extensions/debug/reference/actions/action/index.md#method-prepareShell) | Prepares the shared shell for a request panel or nested panel action. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-render"></span>[`render()`](/docs/extensions/debug/reference/actions/action/index.md#method-render) | Renders a debugger view wrapped in the shared page layout. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-renderPartial"></span>[`renderPartial()`](/docs/extensions/debug/reference/actions/action/index.md#method-renderPartial) | Renders a debugger view without the page layout. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| [`run()`](#method-run) | Runs the comparison page. | `CompareAction` |
| <span id="method-runWithParams"></span>[`runWithParams()`](/docs/api/yii/base/action/index.md#method-runWithParams) | Runs this action with the specified parameters. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="method-setModule"></span>[`setModule()`](/docs/api/yii/base/action/index.md#method-setModule) | Sets the module that owns this action when invoked standalone. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="method-trigger"></span>[`trigger()`](/docs/api/yii/base/component/index.md#method-trigger) | Triggers an event. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-afterRun"></span>[`afterRun()`](/docs/api/yii/base/action/index.md#method-afterRun) protected | This method is called right after `run()` is executed. | [`yii\base\Action`](/docs/api/yii/base/action/index.md) |
| <span id="method-beforeRun"></span>[`beforeRun()`](/docs/extensions/debug/reference/actions/action/index.md#method-beforeRun) protected | Forces the HTML response format and installs the bare shell before the action body runs. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-createBareShellContext"></span>[`createBareShellContext()`](/docs/extensions/debug/reference/actions/action/index.md#method-createBareShellContext) protected | Builds the bare shell installed by [`beforeRun()`](/docs/extensions/debug/reference/actions/action/index.md#method-beforeRun) through [`Module::getShellContextFactory()`](/docs/extensions/debug/reference/module/index.md#method-getShellContextFactory). | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-createPanelRenderContext"></span>[`createPanelRenderContext()`](/docs/extensions/debug/reference/actions/action/index.md#method-createPanelRenderContext) protected | Builds the portable state available to shared panel renderers for the active snapshot. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-createShellContext"></span>[`createShellContext()`](/docs/extensions/debug/reference/actions/action/index.md#method-createShellContext) protected | Builds the shared shell for an index or view page through [`Module::getShellContextFactory()`](/docs/extensions/debug/reference/module/index.md#method-getShellContextFactory). | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-getLogTarget"></span>[`getLogTarget()`](/docs/extensions/debug/reference/actions/action/index.md#method-getLogTarget) protected | Returns the initialized debug log target. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-getMailCollector"></span>[`getMailCollector()`](/docs/extensions/debug/reference/actions/action/index.md#method-getMailCollector) protected | Returns the registered mail collector. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-getPanel"></span>[`getPanel()`](/docs/extensions/debug/reference/actions/action/index.md#method-getPanel) protected | Returns a registered panel by ID. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-prepareIndexShell"></span>[`prepareIndexShell()`](/docs/extensions/debug/reference/actions/action/index.md#method-prepareIndexShell) protected | Prepares the shared shell for the request history page. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-renderPanelError"></span>[`renderPanelError()`](/docs/extensions/debug/reference/actions/action/index.md#method-renderPanelError) protected | Renders a JSON-safe panel exception snapshot through Yii's exception view. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |
| <span id="method-resolveStandaloneParams"></span>[`resolveStandaloneParams()`](/docs/api/yii/web/action/index.md#method-resolveStandaloneParams) protected | Resolves the parameters of `run()` using the same HTTP-aware binder as [`Controller::bindActionParams()`](/docs/api/yii/web/controller/index.md#method-bindActionParams). | [`yii\web\Action`](/docs/api/yii/web/action/index.md) |
| <span id="method-resolveTheme"></span>[`resolveTheme()`](/docs/extensions/debug/reference/actions/action/index.md#method-resolveTheme) protected | Resolves the effective light or dark theme. | [`Action`](/docs/extensions/debug/reference/actions/action/index.md) |

## Method details

### run() <span id="method-run"></span>

```php
public function run(string|null $baseline = null, string|null $target = null): string
```

Runs the comparison page.

When tags are omitted, the newest capture is selected as the target and the preceding capture as the baseline.
Unknown or rotated tags fail explicitly instead of silently selecting a different request.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$baseline` | `string\|null` | Baseline request tag. |
| `$target` | `string\|null` | Target request tag. |

**Returns**

`string`: Rendered comparison page.

**Throws**

- [`yii\web\NotFoundHttpException`](/docs/api/yii/web/notfoundhttpexception/index.md): when omitted tags cannot resolve a comparison pair or a requested snapshot is unavailable.