wp-user-avatar
/
third-party
/
vendor
/
sabberworm
/
php-css-parser
/
src
/
Position
Last commit date
Position.php
5 days ago
Positionable.php
5 days ago
Position.php
50 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace ProfilePressVendor\Sabberworm\CSS\Position; |
| 5 | |
| 6 | /** |
| 7 | * Provides a standard reusable implementation of `Positionable`. |
| 8 | * |
| 9 | * @internal |
| 10 | * |
| 11 | * @phpstan-require-implements Positionable |
| 12 | */ |
| 13 | trait Position |
| 14 | { |
| 15 | /** |
| 16 | * @var int<1, max>|null |
| 17 | */ |
| 18 | protected $lineNumber; |
| 19 | /** |
| 20 | * @var int<0, max>|null |
| 21 | */ |
| 22 | protected $columnNumber; |
| 23 | /** |
| 24 | * @return int<1, max>|null |
| 25 | */ |
| 26 | public function getLineNumber(): ?int |
| 27 | { |
| 28 | return $this->lineNumber; |
| 29 | } |
| 30 | /** |
| 31 | * @return int<0, max>|null |
| 32 | */ |
| 33 | public function getColumnNumber(): ?int |
| 34 | { |
| 35 | return $this->columnNumber; |
| 36 | } |
| 37 | /** |
| 38 | * @param int<1, max>|null $lineNumber |
| 39 | * @param int<0, max>|null $columnNumber |
| 40 | * |
| 41 | * @return $this fluent interface |
| 42 | */ |
| 43 | public function setPosition(?int $lineNumber, ?int $columnNumber = null): Positionable |
| 44 | { |
| 45 | $this->lineNumber = $lineNumber; |
| 46 | $this->columnNumber = $columnNumber; |
| 47 | return $this; |
| 48 | } |
| 49 | } |
| 50 |