public static function forKeys(array $keys, Exception $cause = null) { return new static(sprintf('The keys "%s" does not exist.', implode('", "', $keys)), 0, $cause); }
/** * {@inheritdoc} */ public function getMultipleOrFail(array $keys) { KeyUtil::validateMultiple($keys); // Normalize indices of the array $keys = array_values($keys); $values = array(); $notFoundKeys = array(); try { $serializedValues = $this->clientGetMultiple($keys); } catch (Exception $e) { throw ReadException::forException($e); } foreach ($serializedValues as $i => $serializedValue) { if ($this->clientNotFoundValue() === $serializedValue) { $notFoundKeys[] = $keys[$i]; } elseif (0 === count($notFoundKeys)) { $values[$keys[$i]] = Serializer::unserialize($serializedValue); } } if (0 !== count($notFoundKeys)) { throw NoSuchKeyException::forKeys($notFoundKeys); } return $values; }