blob: 03b387d6f80d98a948f29a95571fb3d376624c9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
namespace ipl\Web\Common;
use LogicException;
abstract class BaseOrderedListItem extends BaseListItem
{
/** @var ?int This element's position */
protected $order;
/**
* Set this element's position
*
* @param int $order
*
* @return $this
*/
public function setOrder(int $order): self
{
$this->order = $order;
return $this;
}
/**
* Get this element's position
*
* @return int
* @throws LogicException When calling this method without setting the `order` property
*/
public function getOrder(): int
{
if ($this->order === null) {
throw new LogicException(
'You are accessing an unset property. Please make sure to set it beforehand.'
);
}
return $this->order;
}
}
|