public function setPublicProfileUrl($url)
    {
        // Avoids errors like: "[invalid.param.url]. Public profile URL is not correct, {url=xyz should be
        // {https://www.linkedin.com/pub/[member-name/]x/y/z}.  LinkedIn won't validate it's own public urls that
        // have a language / country code appended
        $matches = array();
        preg_match('"^https?://((www|\w\w)\.)?linkedin.com/((in/[^/]+/?)|(pub/[^/]+/((\w|\d)+/?){3}))"', $url, $matches);
        if (count($matches)) {
            $url = current($matches);
        }
        $url = rtrim($url, '/');
        
        //according to their manual and forums, all linkedin public urls should begin with 'https://www.linkedin.com'
        //(they said they'd always support it even if it did ever change, which is highly unlikely)
        //so just chop it off and force it to be that
        $url = preg_replace('/^(.*)linkedin.com\//i', 'https://www.linkedin.com/', $url);

        $this->_public_profile_url = $url;

        return $this;
    }