# RouteInventoryView

> Immutable route inventory and provenance displayed by the Request panel.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Request](/docs/extensions/debug-core/reference/panel/request/index.md) › [Routing](/docs/extensions/debug-core/reference/panel/request/routing/index.md) › RouteInventoryView

| final class | `PHPForge\Debug\Panel\Request\Routing\RouteInventoryView` |
| --- | --- |
| Source | [`src/Panel/Request/Routing/RouteInventoryView.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Request/Routing/RouteInventoryView.php#L10) |

Immutable route inventory and provenance displayed by the Request panel.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a route inventory with its provenance. | `RouteInventoryView` |
| [`create()`](#method-create) static | Creates a route inventory ready for immutable enrichment. | `RouteInventoryView` |
| [`getBadges()`](#method-getBadges) | Returns the badges derived from the inventory. | `RouteInventoryView` |
| [`getError()`](#method-getError) | Returns the error generated while building the inventory. | `RouteInventoryView` |
| [`getRoutes()`](#method-getRoutes) | Returns the route definitions the inventory holds. | `RouteInventoryView` |
| [`getSource()`](#method-getSource) | Returns the label describing where the inventory data came from. | `RouteInventoryView` |
| [`isLive()`](#method-isLive) | Determines whether the inventory reflects live configuration. | `RouteInventoryView` |
| [`withBadges()`](#method-withBadges) | Returns a copy carrying another set of badges. | `RouteInventoryView` |
| [`withError()`](#method-withError) | Returns a copy carrying another inventory error. | `RouteInventoryView` |
| [`withLive()`](#method-withLive) | Returns a copy flagged as live configuration or as a stored capture. | `RouteInventoryView` |
| [`withSource()`](#method-withSource) | Returns a copy carrying another source label. | `RouteInventoryView` |

## Method details

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

```php
public function __construct(list<PHPForge\Debug\Panel\Request\Routing\RouteDefinition> $routes)
```

Creates a route inventory with its provenance.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$routes` | `list<`[`RouteDefinition`](/docs/extensions/debug-core/reference/panel/request/routing/routedefinition/index.md)`>` | Route definitions the application declares. |

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

```php
public static function create(list<PHPForge\Debug\Panel\Request\Routing\RouteDefinition> $routes): self
```

Creates a route inventory ready for immutable enrichment.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$routes` | `list<`[`RouteDefinition`](/docs/extensions/debug-core/reference/panel/request/routing/routedefinition/index.md)`>` | Route definitions the application declares. |

**Returns**

`self`: Inventory carrying only the route definitions.

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

```php
public function getBadges(): list<PHPForge\Debug\Panel\Request\Routing\RouteBadge>
```

Returns the badges derived from the inventory.

**Returns**

`list<`[`RouteBadge`](/docs/extensions/debug-core/reference/panel/request/routing/routebadge/index.md)`>`: Route badges derived from the inventory.

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

```php
public function getError(): string|null
```

Returns the error generated while building the inventory.

**Returns**

`string|null`: Error message, or `null` when no error occurred.

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

```php
public function getRoutes(): list<PHPForge\Debug\Panel\Request\Routing\RouteDefinition>
```

Returns the route definitions the inventory holds.

**Returns**

`list<`[`RouteDefinition`](/docs/extensions/debug-core/reference/panel/request/routing/routedefinition/index.md)`>`: Route definitions the application declares.

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

```php
public function getSource(): string
```

Returns the label describing where the inventory data came from.

**Returns**

`string`: Source label describing where the inventory data came from.

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

```php
public function isLive(): bool
```

Determines whether the inventory reflects live configuration.

**Returns**

`bool`: `true` when the inventory reflects live configuration, `false` for a stored capture.

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

```php
public function withBadges(list<PHPForge\Debug\Panel\Request\Routing\RouteBadge> $badges): self
```

Returns a copy carrying another set of badges.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$badges` | `list<`[`RouteBadge`](/docs/extensions/debug-core/reference/panel/request/routing/routebadge/index.md)`>` | Route badges derived from the inventory. |

**Returns**

`self`: Inventory with the badges applied.

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

```php
public function withError(string|null $error): self
```

Returns a copy carrying another inventory error.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$error` | `string\|null` | Error message generated while building the inventory, or `null` to clear it. |

**Returns**

`self`: Inventory with the error applied.

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

```php
public function withLive(bool $live): self
```

Returns a copy flagged as live configuration or as a stored capture.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$live` | `bool` | `true` when the inventory reflects live configuration, `false` for a stored capture. |

**Returns**

`self`: Inventory with the live flag applied.

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

```php
public function withSource(string $source): self
```

Returns a copy carrying another source label.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$source` | `string` | Source label describing where the inventory data came from. |

**Returns**

`self`: Inventory with the source applied.