PHP Класс TTools\App

Показать файл Открыть проект

Открытые методы

Метод Описание
__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

Приватные методы

Метод Описание
setState ( $state ) Internal - Sets current state.

Описание методов

__construct() публичный Метод

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() публичный Метод

Destroy a tweet
public destroy ( string $tweet_id ) : array | mixed
$tweet_id string The ID of the tweet
Результат array | mixed

get() публичный Метод

Performs a GET request to the Twitter API
public get ( $path, array $params = [] ) : array
$path
$params array
Результат array

getCredentials() публичный Метод

Get logged user profile
public getCredentials ( ) : array
Результат array

getCurrentUser() публичный Метод

Gets the current logged user, if any.
public getCurrentUser ( ) : User
Результат User

getFavorites() публичный Метод

Gets current user favorites
public getFavorites ( integer $limit = 10 ) : array
$limit integer
Результат array

getLastReqInfo() публичный Метод

Gets information about the last request.
public getLastReqInfo ( ) : array
Результат array

getLoggedUser() публичный Метод

Returns a User object with ArrayAccess. Returns null if there's no logged user.
public getLoggedUser ( ) : User
Результат User

getLoginUrl() публичный Метод

public getLoginUrl ( string $callbackUrl = null ) : string
$callbackUrl string Absolute URL which Twitter redirects to after the user successfully connected with the app
Результат string

getMentions() публичный Метод

Gets mentions for the current user
public getMentions ( integer $limit = 10 ) : array
$limit integer
Результат array

getProfile() публичный Метод

Example: $profile = $ttools->getProfile(array('screen_name' => 'erikaheidi));
public getProfile ( array $params = null ) : array
$params array The twitter user ID or screen_name(optional)
Результат array

getRemainingCalls() публичный Метод

Returns information about the API usage and how many calls you have left.
public getRemainingCalls ( ) : array
Результат array

getState() публичный Метод

Returns current state
public getState ( ) : integer
Результат integer

getTimeline() публичный Метод

Gets the home timeline for current authenticated user
public getTimeline ( integer $limit = 10 ) : array
$limit integer
Результат array

getTweet() публичный Метод

Gets a specific Tweet
public getTweet ( string $tweet_id ) : array
$tweet_id string The tweet id
Результат array

getUser() публичный Метод

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
Результат User Returns a TTools User object or null if there's no logged user.

getUserTimeline() публичный Метод

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
Результат array

getUserTokens() публичный Метод

public getUserTokens ( ) : array
Результат array

isLogged() публичный Метод

public isLogged ( ) : integer
Результат integer

linkify() публичный Метод

Renders links, hash tags, and account mentions of a Tweet message as clickable links
public linkify ( string $message ) : string
$message string The tweet message
Результат string

logout() публичный Метод

public logout ( ) : mixed
Результат mixed

post() публичный Метод

Performs a POST request to the Twitter API
public post ( $path, $params, boolean $multipart = false ) : array
$path
$params
$multipart boolean
Результат array

update() публичный Метод

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.
Результат array

updateWithMedia() публичный Метод

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.
Результат array

uploadMedia() публичный Метод

Uploads media to uploads.twitter.com to be embedded in tweets
public uploadMedia ( string $image ) : array
$image string Path to the image/media file
Результат array Response