private function checkUrl(&$url)
    {
        if ( ! is_string($url)) {
            throw new InvalidUrlException(
                'The url must be a string value, ' . gettype($url) . ' given'
            );
        }

        $url = trim($url);

        if (empty($url)) {
            throw new InvalidUrlException('The url must not be empty');
        }

        if (filter_var($url, FILTER_VALIDATE_URL) === false) {
            throw new InvalidUrlException('The url [' . $url . '] is invalid');
        }
    }