Twitter
        
        extends AbstractLinkProvider
    
    
            
            in package
            
        
    
    
    
Tags
Table of Contents
Constants
- STATUS_URL_PATTERN = '%https?://(www\\.)?(twitter|x)\\.com/(?:\\#!/)?(\\w+)/status(es)?/(\\d+)%'
 - USER_URL_PATTERN = '%https?://(www\\.)?(twitter|x)\\.com/(#!/)?@?([^/]*)%'
 
Properties
- $apiKey : string
 - $secretKey : string
 - $tokenUrl : string
 - $tweetsUrl : string
 - $usersUrl : string
 
Methods
- __construct() : mixed
 - crawlContent() : array<string, mixed>
 - Try to crawl the content using HTTP client.
 - parseUrl() : array<string|int, mixed>|null
 - setOptions() : void
 - verifyUrl() : bool
 - getDefaultContent() : array<string, mixed>
 - The default fallback data.
 - parseFailedHtml() : array<string, mixed>
 - Get the content from error twitter url.
 - parseSuccessfulHtml() : array<string, mixed>
 - Get the content from success twitter url.
 - getAccessToken() : string|null
 - getContent() : array<string, mixed>|null
 - processStatus() : array<string, mixed>
 - processUser() : array<string, mixed>
 
Constants
STATUS_URL_PATTERN
    public
        mixed
    STATUS_URL_PATTERN
    = '%https?://(www\\.)?(twitter|x)\\.com/(?:\\#!/)?(\\w+)/status(es)?/(\\d+)%'
    
    
    
USER_URL_PATTERN
    public
        mixed
    USER_URL_PATTERN
    = '%https?://(www\\.)?(twitter|x)\\.com/(#!/)?@?([^/]*)%'
    
    
    
Properties
$apiKey
    private
        string
    $apiKey
    
    
    
    
$secretKey
    private
        string
    $secretKey
    
    
    
    
$tokenUrl
    private
        string
    $tokenUrl
     = 'https://api.twitter.com/oauth2/token'
    
    
    
$tweetsUrl
    private
        string
    $tweetsUrl
     = 'https://api.twitter.com/2/tweets'
    
    
    
$usersUrl
    private
        string
    $usersUrl
     = 'https://api.twitter.com/2/users'
    
    
    
Methods
__construct()
    public
                    __construct([array<string|int, mixed> $options = [] ]) : mixed
    Parameters
- $options : array<string|int, mixed> = []
 
crawlContent()
Try to crawl the content using HTTP client.
    public
                    crawlContent(string $url) : array<string, mixed>
    Parameters
- $url : string
 
Return values
array<string, mixed>parseUrl()
    public
                    parseUrl(string $url) : array<string|int, mixed>|null
    Parameters
- $url : string
 
Return values
array<string|int, mixed>|nullsetOptions()
    public
                    setOptions(array<string|int, mixed> $options) : void
    Parameters
- $options : array<string|int, mixed>
 
verifyUrl()
    public
                    verifyUrl(string $url[, mixed &$matches = [] ]) : bool
    Parameters
- $url : string
 - $matches : mixed = []
 
Return values
boolgetDefaultContent()
The default fallback data.
    protected
                    getDefaultContent() : array<string, mixed>
    Return values
array<string, mixed>parseFailedHtml()
Get the content from error twitter url.
    protected
                    parseFailedHtml(DOMDocument $html) : array<string, mixed>
    Parameters
- $html : DOMDocument
 
Return values
array<string, mixed>parseSuccessfulHtml()
Get the content from success twitter url.
    protected
                    parseSuccessfulHtml(DOMDocument $html) : array<string, mixed>
    Parameters
- $html : DOMDocument
 
Return values
array<string, mixed>getAccessToken()
    private
                    getAccessToken() : string|null
    Return values
string|nullgetContent()
    private
                    getContent(string $url, string $token) : array<string, mixed>|null
    Parameters
- $url : string
 - $token : string
 
Return values
array<string, mixed>|nullprocessStatus()
    private
                    processStatus(array<string|int, mixed> $content) : array<string, mixed>
    Parameters
- $content : array<string|int, mixed>
 
Return values
array<string, mixed>processUser()
    private
                    processUser(array<string|int, mixed> $content) : array<string, mixed>
    Parameters
- $content : array<string|int, mixed>