Telegram\Bot\Api::__call PHP Method

__call() public method

Magic method to process any "get" requests.
public __call ( $method, $arguments ) : boolean | TelegramResponse | Telegram\Bot\Objects\UnknownObject
$method
$arguments
return boolean | TelegramResponse | Telegram\Bot\Objects\UnknownObject
    public function __call($method, $arguments)
    {
        if (preg_match('/^\\w+Commands?/', $method, $matches)) {
            return call_user_func_array([$this->getCommandBus(), $matches[0]], $arguments);
        }
        $action = substr($method, 0, 3);
        if ($action === 'get') {
            /* @noinspection PhpUndefinedFunctionInspection */
            $class_name = studly_case(substr($method, 3));
            $class = 'Telegram\\Bot\\Objects\\' . $class_name;
            $response = $this->post($method, $arguments[0] ?: []);
            if (class_exists($class)) {
                return new $class($response->getDecodedBody());
            }
            return $response;
        }
        $response = $this->post($method, $arguments[0]);
        return new UnknownObject($response->getDecodedBody());
    }