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

__construct() public method

ServerResponse constructor.
public __construct ( array $data, string $bot_name )
$data array
$bot_name string
    public function __construct(array $data, $bot_name)
    {
        // Make sure we don't double-save the raw_data
        unset($data['raw_data']);
        $data['raw_data'] = $data;
        $is_ok = isset($data['ok']) ? (bool) $data['ok'] : false;
        $result = isset($data['result']) ? $data['result'] : null;
        if ($is_ok && is_array($result)) {
            if ($this->isAssoc($result)) {
                $data['result'] = $this->createResultObject($result, $bot_name);
            } else {
                $data['result'] = $this->createResultObjects($result, $bot_name);
            }
        }
        parent::__construct($data, $bot_name);
    }