PHP Class SocialShare\SocialShare

Author: Kévin Dunglas ([email protected])
Mostrar archivo Open project: dunglas/php-socialshare Class Usage Examples

Public Methods

Method Description
__construct ( Doctrine\Common\Cache\Cache $cache )
getLink ( string $providerName, string $url, array $options = [] ) : string Gets the sharing links for the given provider and url.
getShares ( string $providerName, string $url, boolean $delayUpdate = false ) : integer Gets the number of share of the given URL on the given provider.
getSharesTotal ( string $url ) : integer Gets the total number of share of the given URL for all providers.
registerProvider ( SocialShare\Provider\ProviderInterface $provider, integer | DateInterval $lifeTime = 3600 ) Registers a provider.
update ( ) Updates delayed URLs.

Private Methods

Method Description
checkProvider ( string $providerName ) Checks if the provider is registered.
getId ( string $providerName, string $url ) : string Gets the ID corresponding to this provider name and URL.

Method Details

__construct() public method

public __construct ( Doctrine\Common\Cache\Cache $cache )
$cache Doctrine\Common\Cache\Cache

getShares() public method

Gets the number of share of the given URL on the given provider.
public getShares ( string $providerName, string $url, boolean $delayUpdate = false ) : integer
$providerName string
$url string
$delayUpdate boolean
return integer

getSharesTotal() public method

Gets the total number of share of the given URL for all providers.
public getSharesTotal ( string $url ) : integer
$url string
return integer

registerProvider() public method

Registers a provider.
public registerProvider ( SocialShare\Provider\ProviderInterface $provider, integer | DateInterval $lifeTime = 3600 )
$provider SocialShare\Provider\ProviderInterface
$lifeTime integer | DateInterval Life time in seconds or a \DateInterval instance

update() public method

Updates delayed URLs.
public update ( )