PHP Class TTools\App

Afficher le fichier Open project: ttools/ttools

Méthodes publiques

Méthode Description
__construct ( array $config, TTools\Provider\StorageProviderInterface $sp = null, TTools\Provider\RequestProviderInterface $rp = null )
destroy ( string $tweet_id ) : array | mixed Destroy a tweet
get ( $path, array $params = [] ) : array Performs a GET request to the Twitter API
getCredentials ( ) : array Get logged user profile
getCurrentUser ( ) : User Gets the current logged user, if any.
getFavorites ( integer $limit = 10 ) : array Gets current user favorites
getLastReqInfo ( ) : array Gets information about the last request.
getLoggedUser ( ) : User Returns a User object with ArrayAccess. Returns null if there's no logged user.
getLoginUrl ( string $callbackUrl = null ) : string
getMentions ( integer $limit = 10 ) : array Gets mentions for the current user
getProfile ( array $params = null ) : array Gets a user profile. If you want to get another user's profile, you just need to provide an array with either the 'user_id' or the 'screen_name' .
getRemainingCalls ( ) : array Returns information about the API usage and how many calls you have left.
getState ( ) : integer Returns current state
getTimeline ( integer $limit = 10 ) : array Gets the home timeline for current authenticated user
getTweet ( string $tweet_id ) : array Gets a specific Tweet
getUser ( ) : User Retrieves the Twitter User. If there's no logged user yet, it will check if the user is coming back from the Twitter Auth page and retrieve its tokens.
getUserTimeline ( null $user_id = null, null $screen_name = null, integer $limit = 10 ) : array Gets a user timeline (tweets posted by a user). Defaults to the current user timeline
getUserTokens ( ) : array
isLogged ( ) : integer
linkify ( string $message ) : string Renders links, hash tags, and account mentions of a Tweet message as clickable links
logout ( ) : mixed
post ( $path, $params, boolean $multipart = false ) : array Performs a POST request to the Twitter API
update ( string $message, string $in_reply_to = null, $media = [] ) : array Post a tweet
updateWithMedia ( string $image, string $message, string $in_reply_to = null ) : array Post a tweet with an image embedded - to keep backwards compatibility
uploadMedia ( string $image ) : array Uploads media to uploads.twitter.com to be embedded in tweets

Private Methods

Méthode Description
setState ( $state ) Internal - Sets current state.

Method Details

__construct() public méthode

public __construct ( array $config, TTools\Provider\StorageProviderInterface $sp = null, TTools\Provider\RequestProviderInterface $rp = null )
$config array
$sp TTools\Provider\StorageProviderInterface
$rp TTools\Provider\RequestProviderInterface

destroy() public méthode

Destroy a tweet
public destroy ( string $tweet_id ) : array | mixed
$tweet_id string The ID of the tweet
Résultat array | mixed

get() public méthode

Performs a GET request to the Twitter API
public get ( $path, array $params = [] ) : array
$path
$params array
Résultat array

getCredentials() public méthode

Get logged user profile
public getCredentials ( ) : array
Résultat array

getCurrentUser() public méthode

Gets the current logged user, if any.
public getCurrentUser ( ) : User
Résultat User

getFavorites() public méthode

Gets current user favorites
public getFavorites ( integer $limit = 10 ) : array
$limit integer
Résultat array

getLastReqInfo() public méthode

Gets information about the last request.
public getLastReqInfo ( ) : array
Résultat array

getLoggedUser() public méthode

Returns a User object with ArrayAccess. Returns null if there's no logged user.
public getLoggedUser ( ) : User
Résultat User

getLoginUrl() public méthode

public getLoginUrl ( string $callbackUrl = null ) : string
$callbackUrl string Absolute URL which Twitter redirects to after the user successfully connected with the app
Résultat string

getMentions() public méthode

Gets mentions for the current user
public getMentions ( integer $limit = 10 ) : array
$limit integer
Résultat array

getProfile() public méthode

Example: $profile = $ttools->getProfile(array('screen_name' => 'erikaheidi));
public getProfile ( array $params = null ) : array
$params array The twitter user ID or screen_name(optional)
Résultat array

getRemainingCalls() public méthode

Returns information about the API usage and how many calls you have left.
public getRemainingCalls ( ) : array
Résultat array

getState() public méthode

Returns current state
public getState ( ) : integer
Résultat integer

getTimeline() public méthode

Gets the home timeline for current authenticated user
public getTimeline ( integer $limit = 10 ) : array
$limit integer
Résultat array

getTweet() public méthode

Gets a specific Tweet
public getTweet ( string $tweet_id ) : array
$tweet_id string The tweet id
Résultat array

getUser() public méthode

Retrieves the Twitter User. If there's no logged user yet, it will check if the user is coming back from the Twitter Auth page and retrieve its tokens.
public getUser ( ) : User
Résultat User Returns a TTools User object or null if there's no logged user.

getUserTimeline() public méthode

Gets a user timeline (tweets posted by a user). Defaults to the current user timeline
public getUserTimeline ( null $user_id = null, null $screen_name = null, integer $limit = 10 ) : array
$user_id null If specified, will try to get this user id tweets
$screen_name null If specified, will try to get this user screen_name tweets
$limit integer
Résultat array

getUserTokens() public méthode

public getUserTokens ( ) : array
Résultat array

isLogged() public méthode

public isLogged ( ) : integer
Résultat integer

linkify() public méthode

Renders links, hash tags, and account mentions of a Tweet message as clickable links
public linkify ( string $message ) : string
$message string The tweet message
Résultat string

logout() public méthode

public logout ( ) : mixed
Résultat mixed

post() public méthode

Performs a POST request to the Twitter API
public post ( $path, $params, boolean $multipart = false ) : array
$path
$params
$multipart boolean
Résultat array

update() public méthode

Post a tweet
public update ( string $message, string $in_reply_to = null, $media = [] ) : array
$message string The tweet message
$in_reply_to string [optional] A tweet id that this post is replying to. Twitter ignores this param if you don't mention the user in the tweet message.
Résultat array

updateWithMedia() public méthode

Post a tweet with an image embedded - to keep backwards compatibility
public updateWithMedia ( string $image, string $message, string $in_reply_to = null ) : array
$image string Path to the image file
$message string Message to be posted with the image
$in_reply_to string [optional] A tweet id that this post is replying to. Twitter ignores this param if you don't mention the user in the tweet message.
Résultat array

uploadMedia() public méthode

Uploads media to uploads.twitter.com to be embedded in tweets
public uploadMedia ( string $image ) : array
$image string Path to the image/media file
Résultat array Response