public function getUrl($service, $url, $params = [])
    {
        if (!empty($this->stubs[$service])) {
            $tokens = [];
            $params['url'] = $url;
            foreach ($this->tokens as $token) {
                $tokens['/{' . $token . '}/'] = urlencode(
                    !empty($params[$token]) ? $params[$token] : ''
                );
            }
            return preg_replace(array_keys($tokens), $tokens, $this->stubs[$service]);
        }
    }
public function getUrl($service, $url, $params = [])
    {
        if (!empty($this->stubs[$service])) {
            $tokens = [];
            $params['url'] = $url;
            foreach ($this->tokens as $token) {
                $tokens['/{' . $token . '}/'] = urlencode(
                    !empty($params[$token]) ? $params[$token] : ''
                );
            }
            return preg_replace(array_keys($tokens), $tokens, $this->stubs[$service]);
        }
    }
public function getUrl ( $ service , $ url , $ params = [ ] ) { if ( ! empty ( $ this -> stubs [ $ service ] ) ) { $ tokens = [ ] ; $ params [ 'url' ] = $ url ; foreach ( $ this -> tokens as $ token ) { $ tokens [ '/{' . $ token . '}/' ] = urlencode ( ! empty ( $ params [ $ token ] ) ? $ params [ $ token ] : '' ) ; } return preg_replace ( array_keys ( $ tokens ) , $ tokens , $ this -> stubs [ $ service ] ) ; } }
Creates a share URL

@param  string $service Social Media service to create share link for
@param  string $url     URL to share
@param  array  $params  Additional share parameters
@return string URL
Creates a share URL