src/Api.php
protected function isValidFileOrUrl($name, $contents)
    {
        //Don't try to open a url as an actual file when using this method to setWebhook.
        if ($name == 'url') {
            return false;
        }

        //If a certificate name is passed, we must check for the file existing on the local server,
        // otherwise telegram ignores the fact it wasn't sent and no error is thrown.
        if ($name == 'certificate') {
            return true;
        }

        //Is the content a valid file name.
        if (is_readable($contents)) {
            return true;
        }

        //Is the content a valid URL
        return filter_var($contents, FILTER_VALIDATE_URL);
    }
protected function isValidFileOrUrl($name, $contents)
    {
        //Don't try to open a url as an actual file when using this method to setWebhook.
        if ($name == 'url') {
            return false;
        }

        //If a certificate name is passed, we must check for the file existing on the local server,
        // otherwise telegram ignores the fact it wasn't sent and no error is thrown.
        if ($name == 'certificate') {
            return true;
        }

        //Is the content a valid file name.
        if (is_readable($contents)) {
            return true;
        }

        //Is the content a valid URL
        return filter_var($contents, FILTER_VALIDATE_URL);
    }
protected function isValidFileOrUrl ( $ name , $ contents ) { //Don't try to open a url as an actual file when using this method to setWebhook. if ( $ name == 'url' ) { return false ; } //If a certificate name is passed, we must check for the file existing on the local server, // otherwise telegram ignores the fact it wasn't sent and no error is thrown. if ( $ name == 'certificate' ) { return true ; } //Is the content a valid file name. if ( is_readable ( $ contents ) ) { return true ; } //Is the content a valid URL return filter_var ( $ contents , FILTER_VALIDATE_URL ) ; }
Determines if the string passed to be uploaded is a valid
file on the local file system, or a valid remote URL.

@param string $name
@param string $contents

@return bool
Determines if the string passed to be uploaded is a valid file on the local file system or a valid remote URL .