X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseEntity.php;h=dca1af4f627b2e29a5494af84bd2666496ce63de;hb=999cdc7db90678c37eeb1f5874d993faa8ab748f;hp=1ea3f8a16b2d713360c0c7a2d16645fdc6673d59;hpb=aa0b485f3dca72c5448076e913fa54d948cd7731;p=friendica.git diff --git a/src/BaseEntity.php b/src/BaseEntity.php index 1ea3f8a16b..dca1af4f62 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 mixed $name + * @return bool + * @throws HTTPException\InternalServerErrorException */ - public function toArray() + public function __isset($name): bool { - return get_object_vars($this); + if (!property_exists($this, $name)) { + throw new HTTPException\InternalServerErrorException('Unknown property ' . $name . ' of type ' . gettype($name) . ' in Entity ' . static::class); + } + + return !empty($this->$name); } }