Longman\TelegramBot\Entities\Entity::makePrettyObjectArray PHP Method

makePrettyObjectArray() protected method

This method is used to generate pretty object arrays mainly for PhotoSize and Entities object arrays.
protected makePrettyObjectArray ( string $class, string $property ) : array
$class string
$property string
return array
    protected function makePrettyObjectArray($class, $property)
    {
        $new_objects = [];
        try {
            if ($objects = $this->getProperty($property)) {
                foreach ($objects as $object) {
                    if (!empty($object)) {
                        $new_objects[] = new $class($object);
                    }
                }
            }
        } catch (Exception $e) {
            $new_objects = [];
        }
        return $new_objects;
    }