/** * @test * @group exception */ public function a_too_high_index_has_the_invalid_index_and_maximum_index_not_minimum_index() { $invalidIndex = 5; $maximumIndex = 4; $exception = IndexOutOfBoundsException::tooHigh($invalidIndex, $maximumIndex); $this->assertEquals($invalidIndex, $exception->getInvalidIndex()); $this->assertEquals($maximumIndex, $exception->getMaximumIndex()); $this->assertNull($exception->getMinimumIndex()); }
/** * @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]; }