public function get($key) { if (!isset($this->resources[$key])) { throw new OutOfBoundsException(sprintf('The offset "%s" does not exist.', $key)); } return $this->resources[$key]; }
/** * @expectedException \OutOfBoundsException */ public function testGetFailsIfNoSuchOffset() { $collection = new ArrayResourceCollection(); $collection->get(0); }