exists() public method

Any integer or string value is accepted as key. If any other type is passed for the key, an {@link InvalidKeyException} is thrown. You should make sure that you only pass valid keys to the store. If the backend of the store cannot be read, a {@link ReadException} is thrown. You should always handle this exception in your code: php try { if ($store->exists($key)) { ... } } catch (ReadException $e) { read failed }
public exists ( integer | string $key ) : boolean
$key integer | string The key to test.
return boolean Whether the key exists in the store.
 /**
  * {@inheritdoc}
  */
 protected function hasBindingsWithTypeName($typeName)
 {
     if (!isset($this->keysByTypeName[$typeName])) {
         return false;
     }
     $key = $this->keysByTypeName[$typeName];
     return isset($this->bindingsByKey[$key]) || $this->store->exists('b:' . $key);
 }
 /**
  * {@inheritdoc}
  */
 public function getBindings()
 {
     $nextId = $this->store->get('//nextId');
     for ($id = 1; $id < $nextId; ++$id) {
         if ($this->store->exists($id)) {
             $this->loadBinding($id);
         }
     }
     return array_values($this->bindings);
 }
 /**
  * {@inheritdoc}
  */
 public function exists($key)
 {
     return $this->store->exists($key);
 }
 /**
  * {@inheritdoc}
  */
 public function contains($path)
 {
     return $this->store->exists($path);
 }