# DiffLine

> Represents a single line of an edit script produced by PHPForge\Diff\DifferInterface.

[API reference](/docs/api/index.md) › [Diff](/docs/extensions/diff/reference/index.md) › DiffLine

| final readonly class | `PHPForge\Diff\DiffLine` |
| --- | --- |
| Source | [`src/DiffLine.php`](https://github.com/php-forge/diff/blob/main/src/DiffLine.php#L10) |

Represents a single line of an edit script produced by [`DifferInterface`](/docs/extensions/diff/reference/differinterface/index.md).

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-line"></span>`$line` readonly constructor | `string` | Line content without its trailing `"\n"`; a `"\r"` left by CRLF input is kept. | `DiffLine` |
| <span id="property-op"></span>`$op` readonly constructor | [`DiffOp`](/docs/extensions/diff/reference/diffop/index.md) | Operation applied to the line. | `DiffLine` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a diff line. | `DiffLine` |

## Method details

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

```php
public function __construct(PHPForge\Diff\DiffOp $op, string $line)
```

Creates a diff line.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$op` | [`DiffOp`](/docs/extensions/diff/reference/diffop/index.md) | Operation applied to the line. |
| `$line` | `string` | Line content without its trailing `"\n"`; a `"\r"` left by CRLF input is kept. |