Skip to content

Commit 01173bf

Browse files
committed
Add IsFirst/IsLast methods to match SS5 conventions (closes #1274)
1 parent 5f8f754 commit 01173bf

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Models/BaseElement.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,22 +1231,26 @@ public function getPageTitle()
12311231
return null;
12321232
}
12331233

1234-
/**
1235-
* @return boolean
1236-
*/
1237-
public function First()
1234+
public function IsFirst(): bool
12381235
{
12391236
return ($this->Parent()->Elements()->first()->ID === $this->ID);
12401237
}
12411238

1242-
/**
1243-
* @return boolean
1244-
*/
1245-
public function Last()
1239+
public function First()
1240+
{
1241+
return $this->IsFirst();
1242+
}
1243+
1244+
public function IsLast(): bool
12461245
{
12471246
return ($this->Parent()->Elements()->last()->ID === $this->ID);
12481247
}
12491248

1249+
public function Last()
1250+
{
1251+
return $this->IsLast();
1252+
}
1253+
12501254
/**
12511255
* @return int
12521256
*/

0 commit comments

Comments
 (0)