src/Slack/Webhook.php
private function setUrl(Url $url)
    {
        $urlValidationRegex = '_https:\/\/hooks.slack.com\/services\/[\w\/]+$_iuS';
        if (!preg_match($urlValidationRegex, (string) $url)) {
            throw new InvalidUrlException(
                sprintf(
                    'The url: "%s" is not a valid url.
                     Slack webhook urls should always start with "https://hooks.slack.com/services/"',
                    $url
                ),
                400
            );
        }
        $this->url = $url;

        return $this;
    }
private function setUrl(Url $url)
    {
        $urlValidationRegex = '_https:\/\/hooks.slack.com\/services\/[\w\/]+$_iuS';
        if (!preg_match($urlValidationRegex, (string) $url)) {
            throw new InvalidUrlException(
                sprintf(
                    'The url: "%s" is not a valid url.
                     Slack webhook urls should always start with "https://hooks.slack.com/services/"',
                    $url
                ),
                400
            );
        }
        $this->url = $url;

        return $this;
    }
private function setUrl ( Url $ url ) { $ urlValidationRegex = '_https:\/\/hooks.slack.com\/services\/[\w\/]+$_iuS' ; if ( ! preg_match ( $ urlValidationRegex , ( string ) $ url ) ) { throw new InvalidUrlException ( sprintf ( 'The url: "%s" is not a valid url.
                     Slack webhook urls should always start with "https://hooks.slack.com/services/"' , $ url ) , 400 ) ; } $ this -> url = $ url ; return $ this ; }
This wil set the url if it is valid.

@param Url $url

@throws InvalidUrlException When it is not a valid webhook url of slack

@return self
This wil set the url if it is valid .