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

__construct() public method

Entity constructor.
public __construct ( array $data, string $bot_name = '' )
$data array
$bot_name string
    public function __construct($data, $bot_name = '')
    {
        //Make sure we're not raw_data inception-ing
        if (array_key_exists('raw_data', $data)) {
            if ($data['raw_data'] === null) {
                unset($data['raw_data']);
            }
        } else {
            $data['raw_data'] = $data;
        }
        $data['bot_name'] = $bot_name;
        $this->assignMemberVariables($data);
        $this->validate();
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function __construct($data)
 {
     if (is_string($data)) {
         $data = ['text' => $data];
     }
     parent::__construct($data);
 }
All Usage Examples Of Longman\TelegramBot\Entities\Entity::__construct