public function hydrate($data) { if ($data['error'] === UPLOAD_ERR_OK) { $input = new File\Input($data); if ($this->preUpload) { $input = call_user_func($this->preUpload, $input); } $newValue = $this->container->upload($input); if ($this->value && $this->container->has($this->value)) { try { $this->container->delete($this->value); } catch (\Exception $ex) { $this->container->delete($newValue); throw $ex; } } $this->value = $newValue; return $this->value; } return $this->value; }
/** * @param string $id */ public function delete($id) { return $this->container->delete($id); }
/** * @param string $id * * @return boolean */ public function has($id) { return $this->container->has($id); }