|
@@ 38-51 (lines=14) @@
|
| 35 |
|
* |
| 36 |
|
* @throws Exceptions\RuntimeException if the type member is not present, or is not a string, or is an empty string |
| 37 |
|
*/ |
| 38 |
|
public function getType() : string |
| 39 |
|
{ |
| 40 |
|
if (!$this->has(DocumentInterface::KEYWORD_TYPE)) { |
| 41 |
|
throw new Exceptions\RuntimeException('Type member not present.'); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
$type = $this->get(DocumentInterface::KEYWORD_TYPE); |
| 45 |
|
|
| 46 |
|
if (!is_string($type) || empty($type)) { |
| 47 |
|
throw new Exceptions\RuntimeException('Type member is not a string, or is empty.'); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
return $type; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
/** |
| 54 |
|
* @return bool |
|
@@ 66-83 (lines=18) @@
|
| 63 |
|
* |
| 64 |
|
* @throws Exceptions\RuntimeException if the id member is not present, or is not a string/int, or is an empty string |
| 65 |
|
*/ |
| 66 |
|
public function getId() : string |
| 67 |
|
{ |
| 68 |
|
if (!$this->has(DocumentInterface::KEYWORD_ID)) { |
| 69 |
|
throw new Exceptions\RuntimeException('Id member not present.'); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
$id = $this->get(DocumentInterface::KEYWORD_ID); |
| 73 |
|
|
| 74 |
|
if (!is_string($id)) { |
| 75 |
|
throw new Exceptions\RuntimeException('Id member is not a string.'); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
if (empty($id)) { |
| 79 |
|
throw new Exceptions\RuntimeException('Id member is an empty string.'); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
return $id; |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
/** |
| 86 |
|
* @return bool |