/** * @test * @group exception */ public function a_too_low_index_has_the_invalid_index_and_minimum_index_not_maximum_index() { $invalidIndex = -1; $minimumIndex = 0; $exception = IndexOutOfBoundsException::tooLow($invalidIndex, $minimumIndex); $this->assertEquals($invalidIndex, $exception->getInvalidIndex()); $this->assertEquals($minimumIndex, $exception->getMinimumIndex()); $this->assertNull($exception->getMaximumIndex()); }
/** * @param int $index * @return NameIdFormat */ public function get($index) { Assertion::integer($index); if ($index < 0) { throw IndexOutOfBoundsException::tooLow($index, 0); } if ($index > count($this->nameIdFormats) - 1) { throw IndexOutOfBoundsException::tooHigh($index, count($this->nameIdFormats) - 1); } return $this->nameIdFormats[$index]; }
/** * @param int $index * @return TelephoneNumber */ public function get($index) { Assertion::integer($index); if ($index < 0) { throw IndexOutOfBoundsException::tooLow($index, 0); } if ($index > count($this->telephoneNumbers) - 1) { throw IndexOutOfBoundsException::tooHigh($index, count($this->telephoneNumbers) - 1); } return $this->telephoneNumbers[$index]; }
/** * @param int $index * @return OrganizationDisplayName */ public function get($index) { Assertion::integer($index); if ($index < 0) { throw IndexOutOfBoundsException::tooLow($index, 0); } if ($index > count($this->organizationDisplayNames) - 1) { throw IndexOutOfBoundsException::tooHigh($index, count($this->organizationDisplayNames) - 1); } return $this->organizationDisplayNames[$index]; }