X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseEntity.php;h=8e8938febc51be2e975ee26a794e3121db9a04a8;hb=22952f88ca6aec54240038fb5484dd35b9369841;hp=1ea3f8a16b2d713360c0c7a2d16645fdc6673d59;hpb=2ec3a97393959e42d450e074271d2d622d25701f;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); } }