public function get($key) { if (!array_key_exists($key, $this->index)) { throw new \OutOfBoundsException($key); } if (!array_key_exists($key, $this->data)) { $this->data[$key] = $this->repository->read($this->index[$key]); } return $this->data[$key]; }
public function get($key) { $this->checkMustQueryBefore(); if (!array_key_exists($key, $this->index)) { throw new \OutOfBoundsException($key); } if (!array_key_exists($key, $this->data)) { $this->data[$key] = $this->repository->read($this->index[$key]); } if ($this->data[$key] === false) { throw new BadRelationException('Not found entry: ' . $this->index[$key]); } return $this->data[$key]; }