Files
ik-codex/src/Log/Line.php
indifferentketchup 66a2fcc5f3 Rename namespace Aternos\Codex to IndifferentKetchup\Codex
Bulk substitution across all PHP files in src/ and test/. Covers
namespace declarations, use statements, fully-qualified class
references, and @package PHPDoc tags. No logic changes.
2026-04-30 15:13:52 +00:00

84 lines
1.4 KiB
PHP

<?php
namespace IndifferentKetchup\Codex\Log;
/**
* Class Line
*
* @package IndifferentKetchup\Codex\Log
*/
class Line implements LineInterface
{
/**
* @param int $number
* @param string $text
*/
public function __construct(
protected int $number,
protected string $text)
{
}
/**
* Set the text of the line
*
* @param string $text
* @return $this
*/
public function setText(string $text): static
{
$this->text = $text;
return $this;
}
/**
* Get the text of the line
*
* @return string
*/
public function getText(): string
{
return $this->text;
}
/**
* Set the line number
*
* @param int $number
* @return $this
*/
public function setNumber(int $number): static
{
$this->number = $number;
return $this;
}
/**
* Get the line number
*
* @return int
*/
public function getNumber(): int
{
return $this->number;
}
/**
* @return string
*/
public function __toString(): string
{
return $this->getText();
}
/**
* @return array
*/
public function jsonSerialize(): array
{
return [
'number' => $this->getNumber(),
'content' => $this->getText()
];
}
}