コード例 #1
0
 /**
  * @inheritdoc
  */
 public function get($key)
 {
     if (!$this->containsKey($key)) {
         throw OutOfRangeException::keyOutOfRange($key);
     }
     return $this->items[$key];
 }
コード例 #2
0
 /**
  * @test
  */
 public function it_creates_a_keyOutOfRange_exception()
 {
     $exception = OutOfRangeException::keyOutOfRange(0);
     $this->assertInstanceOf(OutOfRangeException::class, $exception);
     $this->assertSame('Collection does not contain the key 0', $exception->getMessage());
 }