Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 776 Bytes

README.md

File metadata and controls

38 lines (24 loc) · 776 Bytes

Line number

Line numbers as immutable value objects.
With a WeakMap based repository in the background.

installation

composer require davidschwarz/line-number

example

require __DIR__ . '/vendor/autoload.php';

use DavidSchwarz\LineNumber\Line;

$startLine = Line::number(0);
$otherLine = $startLine->add(2);

$otherLine->equals($startLine); // FALSE
$otherLine->equals(2);          // TRUE

(string) Line::number(7);       // '7'
Line::number(7)->i;             // 7

Line::number(-1);               // throws ...\NegativeValueError

Line::number(0)->subtract(2);   // throws ...\NegativeResultError

license

MIT License

author

David Schwarz / Ringsdorf