datatable.directory codebase
https://datatable.directory/
Du kannst nicht mehr als 25 Themen auswählen
Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
32 Zeilen
597 B
32 Zeilen
597 B
<?php
|
|
|
|
|
|
namespace App\Tables;
|
|
|
|
use App\Models\Row;
|
|
|
|
class RowNumerator
|
|
{
|
|
/** @var int */
|
|
private $next;
|
|
/** @var int */
|
|
private $last;
|
|
|
|
/**
|
|
* Create a numerator for the given number of rows.
|
|
*
|
|
* @param int $capacity
|
|
*/
|
|
public function __construct($capacity)
|
|
{
|
|
list($this->next, $this->last) = Row::allocateRowIDs($capacity);
|
|
}
|
|
|
|
public function next()
|
|
{
|
|
if ($this->next > $this->last)
|
|
throw new \OutOfBoundsException("Row numerator has run out of allocated GRID slots");
|
|
|
|
return $this->next++;
|
|
}
|
|
}
|
|
|