← All changes
|
back/Libraries/Sabberworm/CSS/src/Position/Position.php
+55
-0
11.1.1
→
11.1.0
View file →
| @@ -1,0 +1,55 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +namespace AcyMailing\Libraries\Sabberworm\CSS\Position; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Provides a standard reusable implementation of `Positionable`. | |
| 9 | + * | |
| 10 | + * @internal | |
| 11 | + * | |
| 12 | + * @phpstan-require-implements Positionable | |
| 13 | + */ | |
| 14 | +trait Position | |
| 15 | +{ | |
| 16 | + /** | |
| 17 | + * @var int<1, max>|null | |
| 18 | + */ | |
| 19 | + protected $lineNumber; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * @var int<0, max>|null | |
| 23 | + */ | |
| 24 | + protected $columnNumber; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @return int<1, max>|null | |
| 28 | + */ | |
| 29 | + public function getLineNumber(): ?int | |
| 30 | + { | |
| 31 | + return $this->lineNumber; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * @return int<0, max>|null | |
| 36 | + */ | |
| 37 | + public function getColumnNumber(): ?int | |
| 38 | + { | |
| 39 | + return $this->columnNumber; | |
| 40 | + } | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * @param int<1, max>|null $lineNumber | |
| 44 | + * @param int<0, max>|null $columnNumber | |
| 45 | + * | |
| 46 | + * @return $this fluent interface | |
| 47 | + */ | |
| 48 | + public function setPosition(?int $lineNumber, ?int $columnNumber = null): Positionable | |
| 49 | + { | |
| 50 | + $this->lineNumber = $lineNumber; | |
| 51 | + $this->columnNumber = $columnNumber; | |
| 52 | + | |
| 53 | + return $this; | |
| 54 | + } | |
| 55 | +} | |