X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseEntity.php;h=2ee22b1bb0da93056aa1b7d27e0a5a6f1fb20fb7;hb=ab83d0dd27e46e733ecb49f25789bfb318852ac7;hp=1ea3f8a16b2d713360c0c7a2d16645fdc6673d59;hpb=e80d68ba53776bed047d897f52db7e25b35a479d;p=friendica.git diff --git a/src/BaseEntity.php b/src/BaseEntity.php index 1ea3f8a16b..2ee22b1bb0 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); } }