X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseEntity.php;h=8e8938febc51be2e975ee26a794e3121db9a04a8;hb=f23a264cb4656fc100dac12ddba61bafab95e33e;hp=1ea3f8a16b2d713360c0c7a2d16645fdc6673d59;hpb=d09b3f5bdeae444f785f6283e55dbf2f61caadac;p=friendica.git diff --git a/src/BaseEntity.php b/src/BaseEntity.php index 1ea3f8a16b..8e8938febc 100644 --- a/src/BaseEntity.php +++ b/src/BaseEntity.php @@ -1,6 +1,6 @@ toArray(); + if (!property_exists($this, $name)) { + throw new HTTPException\InternalServerErrorException('Unknown property ' . $name . ' in Entity ' . static::class); + } + + return $this->$name; } /** - * Returns the current entity as an array - * - * @return array + * @param $name + * @return bool + * @throws HTTPException\InternalServerErrorException */ - public function toArray() + public function __isset($name) { - return get_object_vars($this); + if (!property_exists($this, $name)) { + throw new HTTPException\InternalServerErrorException('Unknown property ' . $name . ' in Entity ' . static::class); + } + + return !empty($this->$name); } }