RedditHandler
class RedditHandler (View source)
Class for handler Reddit
Properties
| string | $error |
Methods
__construct(array $authParams)
Constructor to initialize RedditHandler.
array<array{id: string, content: string, created_at: string, url: string, author_name?: string, author_avatar?: string, media_url?: string}|array{}>|false
fetch(string $urlAPI, int $maxNb = 5, int $cacheDelay = 60, string $cacheDir = '', array{client_id?: string, client_secret?: string, username?: string, password?: string, name_app?: string} $authParams = [])
Fetch Reddit API to retrieve posts.
array{}|array{id: string, content: string, created_at: string, url: string, media_url: string}
normalizeData(array{id?: string, title?: string, created?: string, permalink?: string, thumbnail?: string} $postData)
Normalize the data fetched from the Reddit API.
array<array{id: string, content: string, created_at: string, url: string, author_name: string, author_avatar?: string}|array{}>
getPosts()
Get the list of retrieved posts.
string
getAuthUrl()
Get url for authenticate with Reddit
Details
__construct(array $authParams)
Constructor to initialize RedditHandler.
array<array{id: string, content: string, created_at: string, url: string, author_name?: string, author_avatar?: string, media_url?: string}|array{}>|false
fetch(string $urlAPI, int $maxNb = 5, int $cacheDelay = 60, string $cacheDir = '', array{client_id?: string, client_secret?: string, username?: string, password?: string, name_app?: string} $authParams = [])
Fetch Reddit API to retrieve posts.
array{}|array{id: string, content: string, created_at: string, url: string, media_url: string}
normalizeData(array{id?: string, title?: string, created?: string, permalink?: string, thumbnail?: string} $postData)
Normalize the data fetched from the Reddit API.
array<array{id: string, content: string, created_at: string, url: string, author_name: string, author_avatar?: string}|array{}>
getPosts()
Get the list of retrieved posts.
string
getAuthUrl()
Get url for authenticate with Reddit