Lines Matching defs:key
53 public function __get(string $key)
55 return $this->get($key);
61 public function __set(string $key, $value): void
63 $this->set($key, $value);
66 public function __isset(string $key): bool
68 return $this->has($key) && null !== $this->get($key);
71 public function __unset(string $key): void
73 $this->remove($key);
79 * @param mixed $key
85 public function get($key)
87 if (!$this->has($key)) {
88 throw new InvalidException("Field {$key} does not exist");
91 return $this->_data[$key];
101 public function set(string $key, $value): self
106 $this->_data[$key] = $value;
114 public function has(string $key): bool
116 return \is_array($this->_data) && \array_key_exists($key, $this->_data);
120 * Removes a field from the document, by the given key.
124 public function remove(string $key): self
126 if (!$this->has($key)) {
127 throw new InvalidException("Field {$key} does not exist");
129 unset($this->_data[$key]);
145 * @param string $key Key to add the file to
149 public function addFile(string $key, string $filepath, string $mimeType = ''): self
157 $this->set($key, $value);
165 public function addFileContent(string $key, string $content): self
167 return $this->set($key, \base64_encode($content));
173 * @param string $key Field key
177 public function addGeoPoint(string $key, float $latitude, float $longitude): self
181 $this->set($key, $value);