abstract class StorageBase in Checklist API 8
Provides a base storage implementation for others to extend.
Hierarchy
- class \Drupal\checklistapi\Storage\StorageBase implements StorageInterface
Expanded class hierarchy of StorageBase
File
- src/
Storage/ StorageBase.php, line 8
Namespace
Drupal\checklistapi\StorageView source
abstract class StorageBase implements StorageInterface {
/**
* The checklist ID.
*
* @var string
*/
private $checklistId;
/**
* Sets the checklist ID.
*
* @param string $id
* The checklist ID.
*
* @return self
* The storage object.
*/
public function setChecklistId($id) {
if (!is_string($id)) {
throw new \InvalidArgumentException('A checklist ID must be a string.');
}
$this->checklistId = $id;
return $this;
}
/**
* Gets the checklist ID.
*
* @return string
* Returns the checklist ID.
*/
protected function getChecklistId() {
if (empty($this->checklistId)) {
throw new \LogicException('You must set the checklist ID before accessing saved progress.');
}
return $this->checklistId;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StorageBase:: |
private | property | The checklist ID. | |
StorageBase:: |
protected | function | Gets the checklist ID. | |
StorageBase:: |
public | function |
Sets the checklist ID. Overrides StorageInterface:: |
|
StorageInterface:: |
public | function | Deletes the saved checklist progress. | 2 |
StorageInterface:: |
public | function | Gets the saved checklist progress. | 2 |
StorageInterface:: |
public | function | Sets the saved checklist progress. | 2 |