ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

34 {
35 $this->checkStart($start);
36 $this->checkLength($length);
37 $this->start = $start;
38 $this->length = $length;
39 }
checkStart(int $start)
Definition: Range.php:41
checkLength(int $length)
Definition: Range.php:48

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

+ 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.

48 : void
49 {
50 if ($length < 0) {
51 throw new \InvalidArgumentException("Length must be larger or equal then 0", 1);
52 }
53 }

References ILIAS\Data\Range\$length.

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

+ Here is the caller graph for this function:

◆ checkStart()

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

Definition at line 41 of file Range.php.

41 : void
42 {
43 if ($start < 0) {
44 throw new \InvalidArgumentException("Start must be a positive number (or 0)", 1);
45 }
46 }

References ILIAS\Data\Range\$start.

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

+ 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.

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

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

Referenced by RangeTest\testCroppedTo().

+ 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.

70 : int
71 {
72 if ($this->length === PHP_INT_MAX) {
73 return PHP_INT_MAX;
74 }
75
76 return $this->start + $this->length;
77 }

References ILIAS\Data\Range\$length.

Referenced by ILIAS\Data\Range\croppedTo(), ilMediaCastManageTableGUI\getRows(), RangeTest\testEndCalculation(), RangeTest\testWithLength(), and RangeTest\testWithStart().

+ Here is the caller graph for this function:

◆ getLength()

ILIAS\Data\Range::getLength ( )

Definition at line 65 of file Range.php.

65 : int
66 {
67 return $this->length;
68 }

References ILIAS\Data\Range\$length.

Referenced by ILIAS\Blog\Contributor\ContributorRetrieval\applyRange(), ILIAS\UI\examples\Table\Data\base(), ilAssQuestionList\buildLimitQueryExpression(), ilUserCertificateRepository\fetchCertificatesForOverviewCount(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\getData(), ILIAS\Test\Questions\RandomQuestionSetNonAvailablePoolsTable\getData(), ilLanguageFolderTable\getItems(), ilLanguageStatisticsTable\getItems(), ilBiblLibraryTableGUI\getRecords(), ILIAS\Cron\Job\Manager\UI\JobTable\getRecords(), ILIAS\LDAP\Server\UI\ServerTable\getRecords(), ILIAS\Mail\Attachments\MailAttachmentTableGUI\getRecords(), ilSamlIdpTableGUI\getRecords(), ILIAS\Forum\Moderation\ForumModeratorsTable\getRecords(), ilDidacticTemplateSettingsTableDataRetrieval\getRecords(), ILIAS\Registration\RegistrationCodesTable\getRecords(), ILIAS\Dashboard\DataRetrieval\Language\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(), ILIAS\Calendar\ConsultationHours\BookingDataProvider\limitData(), ILIAS\Conditions\Configuration\ConditionTriggerProvider\limitData(), ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\limitRecords(), ILIAS\Chatroom\Bans\BannedUsersTable\limitRecords(), ILIAS\Contact\MailingLists\MailingListsMembersTable\limitRecords(), ILIAS\Contact\MailingLists\MailingListsTable\limitRecords(), ILIAS\Contact\MemberSearch\MailMemberSearchTable\limitRecords(), ILIAS\Forum\Drafts\ForumDraftsTable\limitRecords(), ILIAS\Forum\Notification\ForumNotificationTable\limitRecords(), ILIAS\Forum\Statistics\ForumStatisticsTable\limitRecords(), LDAPRoleAssignmentTable\limitRecords(), LDAPRoleMappingTable\limitRecords(), ilMailTemplateTable\limitRecords(), ILIAS\Test\Participants\ParticipantTable\limitRecords(), RangeTest\testValues(), RangeTest\testWithLength(), and RangeTest\testWithStart().

+ Here is the caller graph for this function:

◆ getStart()

ILIAS\Data\Range::getStart ( )

Definition at line 60 of file Range.php.

60 : int
61 {
62 return $this->start;
63 }

References ILIAS\Data\Range\$start.

Referenced by ILIAS\Blog\Contributor\ContributorRetrieval\applyRange(), ILIAS\UI\examples\Table\Data\base(), ilAssQuestionList\buildLimitQueryExpression(), ILIAS\Data\Range\croppedTo(), ilUserCertificateRepository\fetchCertificatesForOverviewCount(), ILIAS\UI\Implementation\Component\Input\ViewControl\Renderer\findCurrentPage(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\getData(), ILIAS\Test\Questions\RandomQuestionSetNonAvailablePoolsTable\getData(), ilLanguageFolderTable\getItems(), ilLanguageStatisticsTable\getItems(), ilBiblLibraryTableGUI\getRecords(), ILIAS\Cron\Job\Manager\UI\JobTable\getRecords(), ILIAS\LDAP\Server\UI\ServerTable\getRecords(), ILIAS\Mail\Attachments\MailAttachmentTableGUI\getRecords(), ilSamlIdpTableGUI\getRecords(), ILIAS\Forum\Moderation\ForumModeratorsTable\getRecords(), ilDidacticTemplateSettingsTableDataRetrieval\getRecords(), ILIAS\Registration\RegistrationCodesTable\getRecords(), ILIAS\Dashboard\DataRetrieval\Language\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(), ILIAS\Calendar\ConsultationHours\BookingDataProvider\limitData(), ILIAS\Conditions\Configuration\ConditionTriggerProvider\limitData(), ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\limitRecords(), ILIAS\Chatroom\Bans\BannedUsersTable\limitRecords(), ILIAS\Contact\MailingLists\MailingListsMembersTable\limitRecords(), ILIAS\Contact\MailingLists\MailingListsTable\limitRecords(), ILIAS\Contact\MemberSearch\MailMemberSearchTable\limitRecords(), ILIAS\Forum\Drafts\ForumDraftsTable\limitRecords(), ILIAS\Forum\Notification\ForumNotificationTable\limitRecords(), ILIAS\Forum\Statistics\ForumStatisticsTable\limitRecords(), LDAPRoleAssignmentTable\limitRecords(), LDAPRoleMappingTable\limitRecords(), ilMailTemplateTable\limitRecords(), ILIAS\Test\Participants\ParticipantTable\limitRecords(), ILIAS\UI\Implementation\Component\Input\ViewControl\Renderer\renderPagination(), RangeTest\testValues(), RangeTest\testWithLength(), and RangeTest\testWithStart().

+ Here is the caller graph for this function:

◆ unpack()

◆ withLength()

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

Definition at line 87 of file Range.php.

87 : Range
88 {
89 $this->checkLength($length);
90 $clone = clone $this;
91 $clone->length = $length;
92 return $clone;
93 }

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

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

+ 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.

79 : Range
80 {
81 $this->checkStart($start);
82 $clone = clone $this;
83 $clone->start = $start;
84 return $clone;
85 }

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

Referenced by RangeTest\testNegativeStart(), and RangeTest\testWithStart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $length

◆ $start


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