This commit is contained in:
Andrew Nicols
2021-10-29 10:16:56 +08:00
3 changed files with 112 additions and 0 deletions
+17
View File
@@ -110,6 +110,8 @@ abstract class persistent {
*
* @param string $property The property name.
* @return $this
*
* @throws coding_exception
*/
final public function set($property, $value) {
if (!static::has_property($property)) {
@@ -123,6 +125,21 @@ abstract class persistent {
return $this->raw_set($property, $value);
}
/**
* Data setter for multiple properties
*
* Internally calls {@see set} on each property
*
* @param array $values Array of property => value elements
* @return $this
*/
final public function set_many(array $values): self {
foreach ($values as $property => $value) {
$this->set($property, $value);
}
return $this;
}
/**
* Data getter.
*