# ShellContextFactory

> Builds the page shell of the debugger actions: the bare shell installed before an action runs, and the full shell with brand bar and sidebar of the history, panel, and standalone pages.

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

| class | `yii\debug\service\ShellContextFactory` |
| --- | --- |
| Source | [`src/service/ShellContextFactory.php`](https://github.com/yii2-extensions/debug/blob/main/src/service/ShellContextFactory.php#L22) |

Builds the page shell of the debugger actions: the bare shell installed before an action runs, and the full shell
with brand bar and sidebar of the history, panel, and standalone pages.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-module"></span>`$module` protected readonly constructor | [`yii\debug\Module`](/docs/extensions/debug/reference/module/index.md) | Debug module read for the page title and the Configuration panel at call time. | `ShellContextFactory` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Binds debugger page-shell creation to the debug module. | `ShellContextFactory` |
| [`bare()`](#method-bare) | Returns the shell that echoes raw content without the brand bar or sidebar. | `ShellContextFactory` |
| [`forSnapshot()`](#method-forSnapshot) | Returns the shell of an index, view, or standalone page. | `ShellContextFactory` |

## Method details

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

```php
public function __construct(yii\debug\Module $module)
```

Binds debugger page-shell creation to the debug module.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$module` | [`yii\debug\Module`](/docs/extensions/debug/reference/module/index.md) | Debug module read for the page title and the Configuration panel at call time. |

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

```php
public function bare(string $theme): yii\debug\widgets\shell\ShellContext
```

Returns the shell that echoes raw content without the brand bar or sidebar.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$theme` | `string` | Resolved light/dark theme. |

**Returns**

[`yii\debug\widgets\shell\ShellContext`](/docs/extensions/debug/reference/widgets/shell/shellcontext/index.md): Bare shell.

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

```php
public function forSnapshot(string $mode, string $theme, array<string, PHPForge\Debug\Storage\RequestSummary> $manifest, string|null $activeTag, PHPForge\Debug\Storage\RequestSummary|null $summary, PHPForge\Debug\View\Sidebar\SidebarView $sidebar): yii\debug\widgets\shell\ShellContext
```

Returns the shell of an index, view, or standalone page.

The brand bar reads the Yii and PHP versions the Configuration panel captured, falling back to the running ones,
and links the Configuration chip to the focused capture, or to the newest one when no capture is focused.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$mode` | `string` | One of the [`ShellContext`](/docs/extensions/debug/reference/widgets/shell/shellcontext/index.md) mode constants. |
| `$theme` | `string` | Resolved light/dark theme. |
| `$manifest` | `array<string, PHPForge\Debug\Storage\RequestSummary>` | Manifest entries indexed by tag, newest first. |
| `$activeTag` | `string\|null` | Tag focused by the page, or `null` on the index. |
| `$summary` | `PHPForge\Debug\Storage\RequestSummary\|null` | Summary of the focused entry, or `null` on the index. |
| `$sidebar` | `PHPForge\Debug\View\Sidebar\SidebarView` | Prepared sidebar payload. |

**Returns**

[`yii\debug\widgets\shell\ShellContext`](/docs/extensions/debug/reference/widgets/shell/shellcontext/index.md): Shell for the requested page.