ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Data\Range Class Reference

A simple class to express a naive range of whole positive numbers. More...

+ Collaboration diagram for ILIAS\Data\Range:

Public Member Functions

 __construct (int $start, int $length)
 
 unpack ()
 
 getStart ()
 
 getLength ()
 
 getEnd ()
 
 withStart (int $start)
 
 withLength (int $length)
 
 croppedTo (int $max)
 This will create a range that is guaranteed to not exceed $max. More...
 

Protected Member Functions

 checkStart (int $start)
 
 checkLength (int $length)
 

Protected Attributes

int $start
 
int $length
 

Detailed Description

A simple class to express a naive range of whole positive numbers.

Author
Nils Haagen nils..nosp@m.haag.nosp@m.en@co.nosp@m.ncep.nosp@m.ts-an.nosp@m.d-tr.nosp@m.ainin.nosp@m.g.de

Definition at line 28 of file Range.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Data\Range::__construct ( int  $start,
int  $length 
)

Definition at line 33 of file Range.php.

References ILIAS\Data\Range\$length, ILIAS\Data\Range\$start, ILIAS\Data\Range\checkLength(), and ILIAS\Data\Range\checkStart().

34  {
35  $this->checkStart($start);
36  $this->checkLength($length);
37  $this->start = $start;
38  $this->length = $length;
39  }
checkLength(int $length)
Definition: Range.php:48
checkStart(int $start)
Definition: Range.php:41
+ Here is the call graph for this function:

Member Function Documentation

◆ checkLength()

ILIAS\Data\Range::checkLength ( int  $length)
protected

Definition at line 48 of file Range.php.

Referenced by ILIAS\Data\Range\__construct(), and ILIAS\Data\Range\withLength().

48  : void
49  {
50  if ($length < 0) {
51  throw new \InvalidArgumentException("Length must be larger or equal then 0", 1);
52  }
53  }
+ Here is the caller graph for this function:

◆ checkStart()

ILIAS\Data\Range::checkStart ( int  $start)
protected

Definition at line 41 of file Range.php.

Referenced by ILIAS\Data\Range\__construct(), and ILIAS\Data\Range\withStart().

41  : void
42  {
43  if ($start < 0) {
44  throw new \InvalidArgumentException("Start must be a positive number (or 0)", 1);
45  }
46  }
+ Here is the caller graph for this function:

◆ croppedTo()

ILIAS\Data\Range::croppedTo ( int  $max)

This will create a range that is guaranteed to not exceed $max.

Definition at line 98 of file Range.php.

References ILIAS\Data\Range\getEnd(), ILIAS\Data\Range\getStart(), and ILIAS\Data\Range\withLength().

Referenced by ILIAS\UI\Implementation\Component\Table\Data\applyViewControls(), and RangeTest\testCroppedTo().

98  : Range
99  {
100  if ($max > $this->getEnd()) {
101  return $this;
102  }
103 
104  if ($this->getStart() > $max) {
105  return new self($max, 0);
106  }
107 
108  return $this->withLength($max - $this->getStart());
109  }
withLength(int $length)
Definition: Range.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnd()

ILIAS\Data\Range::getEnd ( )

Definition at line 70 of file Range.php.

References ILIAS\Data\Range\$length.

Referenced by ILIAS\Data\Range\croppedTo(), ILIAS\UI\Implementation\Component\Input\ViewControl\Renderer\findCurrentPage(), ilMediaCastManageTableGUI\getRows(), RangeTest\testEndCalculation(), RangeTest\testWithLength(), and RangeTest\testWithStart().

70  : int
71  {
72  if ($this->length === PHP_INT_MAX) {
73  return PHP_INT_MAX;
74  }
75 
76  return $this->start + $this->length;
77  }
+ Here is the caller graph for this function:

◆ getLength()

ILIAS\Data\Range::getLength ( )

Definition at line 65 of file Range.php.

References ILIAS\Data\Range\$length.

Referenced by ILIAS\UI\examples\Table\Data\base(), ILIAS\Test\Logging\TestLoggingDatabaseRepository\buildInteractionsStatementWithLimitAndOrder(), ilAssQuestionList\buildLimitQueryExpression(), ilUserCertificateRepository\fetchCertificatesForOverview(), ilUserCertificateRepository\fetchCertificatesForOverviewCount(), ilStudyProgrammeTypeDBRepository\getAllTypes(), ILIAS\Test\Questions\RandomQuestionSetNonAvailablePoolsTable\getData(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\getData(), ilLanguageStatisticsTable\getItems(), ilLanguageFolderTable\getItems(), ilRbacLog\getLogItems(), ilDidacticTemplateSettingsTableDataRetrieval\getRecords(), ilBiblLibraryTableGUI\getRecords(), ILIAS\Dashboard\DataRetrieval\Language\getRows(), ILIAS\Test\Scoring\Manual\ScoringByQuestionTableBinder\getRows(), ilBadgePersonalTableGUI\getRows(), ILIAS\Badge\ilObjectBadgeTableGUI\getRows(), ILIAS\Badge\ilBadgeTypesTableGUI\getRows(), ILIAS\Badge\ilBadgeImageTemplateTableGUI\getRows(), ILIAS\Badge\ilBadgeTableGUI\getRows(), ILIAS\components\ResourceStorage\Container\View\RequestToDataTable\getRows(), ILIAS\Badge\ilBadgeUserTableGUI\getRows(), ILIAS\Mail\Folder\MailFolderTableUI\getRows(), ilOrgUnitTypeGUI\getTableDataRetrieval(), ILIAS\UI\Implementation\Component\Table\getViewControlPagination(), ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\getVocabs(), ILIAS\components\ResourceStorage\Collections\View\RequestToDataTable\initSortingAndOrdering(), ILIAS\components\ResourceStorage\Container\View\RequestToDataTable\initSortingAndOrdering(), ilPresentationTableGUI\initViewControl(), ILIAS\Conditions\Configuration\ConditionTriggerProvider\limitData(), ILIAS\Calendar\ConsultationHours\BookingDataProvider\limitData(), ILIAS\Forum\Drafts\ForumDraftsTable\limitRecords(), ILIAS\Forum\Statistics\ForumStatisticsTable\limitRecords(), ILIAS\Test\Participants\ParticipantTable\limitRecords(), RangeTest\testValues(), RangeTest\testWithLength(), and RangeTest\testWithStart().

65  : int
66  {
67  return $this->length;
68  }
+ Here is the caller graph for this function:

◆ getStart()

ILIAS\Data\Range::getStart ( )

Definition at line 60 of file Range.php.

References ILIAS\Data\Range\$start.

Referenced by ILIAS\UI\Implementation\Component\Table\Data\applyViewControls(), ILIAS\UI\examples\Table\Data\base(), ILIAS\Test\Logging\TestLoggingDatabaseRepository\buildInteractionsStatementWithLimitAndOrder(), ilAssQuestionList\buildLimitQueryExpression(), ILIAS\Data\Range\croppedTo(), ilUserCertificateRepository\fetchCertificatesForOverview(), ilUserCertificateRepository\fetchCertificatesForOverviewCount(), ILIAS\UI\Implementation\Component\Input\ViewControl\Renderer\findCurrentPage(), ilStudyProgrammeTypeDBRepository\getAllTypes(), ILIAS\Test\Questions\RandomQuestionSetNonAvailablePoolsTable\getData(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\getData(), ilLanguageStatisticsTable\getItems(), ilLanguageFolderTable\getItems(), ilRbacLog\getLogItems(), ilDidacticTemplateSettingsTableDataRetrieval\getRecords(), ilBiblLibraryTableGUI\getRecords(), ILIAS\Dashboard\DataRetrieval\Language\getRows(), ILIAS\Test\Scoring\Manual\ScoringByQuestionTableBinder\getRows(), ilBadgePersonalTableGUI\getRows(), ILIAS\Badge\ilObjectBadgeTableGUI\getRows(), ILIAS\Badge\ilBadgeTypesTableGUI\getRows(), ILIAS\Badge\ilBadgeImageTemplateTableGUI\getRows(), ILIAS\Badge\ilBadgeTableGUI\getRows(), ILIAS\components\ResourceStorage\Container\View\RequestToDataTable\getRows(), ILIAS\Badge\ilBadgeUserTableGUI\getRows(), ILIAS\Mail\Folder\MailFolderTableUI\getRows(), ilOrgUnitTypeGUI\getTableDataRetrieval(), ILIAS\UI\Implementation\Component\Table\getViewControlPagination(), ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\getVocabs(), ILIAS\components\ResourceStorage\Collections\View\RequestToDataTable\initSortingAndOrdering(), ILIAS\components\ResourceStorage\Container\View\RequestToDataTable\initSortingAndOrdering(), ilPresentationTableGUI\initViewControl(), ILIAS\Conditions\Configuration\ConditionTriggerProvider\limitData(), ILIAS\Calendar\ConsultationHours\BookingDataProvider\limitData(), ILIAS\Forum\Drafts\ForumDraftsTable\limitRecords(), ILIAS\Forum\Statistics\ForumStatisticsTable\limitRecords(), ILIAS\Test\Participants\ParticipantTable\limitRecords(), ILIAS\UI\Implementation\Component\Input\ViewControl\Renderer\renderPagination(), RangeTest\testValues(), RangeTest\testWithLength(), and RangeTest\testWithStart().

60  : int
61  {
62  return $this->start;
63  }
+ Here is the caller graph for this function:

◆ unpack()

◆ withLength()

ILIAS\Data\Range::withLength ( int  $length)

Definition at line 87 of file Range.php.

References ILIAS\Data\Range\$length, and ILIAS\Data\Range\checkLength().

Referenced by ILIAS\Data\Range\croppedTo(), RangeTest\testNegativeLength(), and RangeTest\testWithLength().

87  : Range
88  {
89  $this->checkLength($length);
90  $clone = clone $this;
91  $clone->length = $length;
92  return $clone;
93  }
checkLength(int $length)
Definition: Range.php:48
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withStart()

ILIAS\Data\Range::withStart ( int  $start)

Definition at line 79 of file Range.php.

References ILIAS\Data\Range\$start, and ILIAS\Data\Range\checkStart().

Referenced by ILIAS\UI\Implementation\Component\Table\Data\applyViewControls(), RangeTest\testNegativeStart(), and RangeTest\testWithStart().

79  : Range
80  {
81  $this->checkStart($start);
82  $clone = clone $this;
83  $clone->start = $start;
84  return $clone;
85  }
checkStart(int $start)
Definition: Range.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $length

int ILIAS\Data\Range::$length
protected

◆ $start

int ILIAS\Data\Range::$start
protected

The documentation for this class was generated from the following file: