PluginProbe
WooCommerce / 11.0.0
WooCommerce v11.0.0
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / lib / packages / Sabberworm / CSS / Position / Position.php
Position.php
73 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Automattic\WooCommerce\Vendor\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()
30 {
31 return $this->lineNumber;
32 }
33
34 /**
35 * @return int<0, max>
36 */
37 public function getLineNo()
38 {
39 $lineNumber = $this->getLineNumber();
40
41 return $lineNumber !== null ? $lineNumber : 0;
42 }
43
44 /**
45 * @return int<0, max>|null
46 */
47 public function getColumnNumber()
48 {
49 return $this->columnNumber;
50 }
51
52 /**
53 * @return int<0, max>
54 */
55 public function getColNo()
56 {
57 $columnNumber = $this->getColumnNumber();
58
59 return $columnNumber !== null ? $columnNumber : 0;
60 }
61
62 /**
63 * @param int<0, max>|null $lineNumber
64 * @param int<0, max>|null $columnNumber
65 */
66 public function setPosition($lineNumber, $columnNumber = null)
67 {
68 // The conditional is for backwards compatibility (backcompat); `0` will not be allowed in future.
69 $this->lineNumber = $lineNumber !== 0 ? $lineNumber : null;
70 $this->columnNumber = $columnNumber;
71 }
72 }
73