\Vigas\StreamingPlatforms\ModelSmashcastAccount

Class SmashcastAccount.

Gets and manage account from Smashcast, interact with database

Summary

Methods
Properties
Constants
__construct()
getPlatform()
getUsername()
getToken()
getProfilPictureUrl()
setToken()
curlRequest()
cryptToken()
decryptToken()
getTokenFromSource()
getUsernameFromSource()
getProfilePictureFromSource()
saveToDB()
getFromDB()
No public properties found
No constants found
No protected methods found
$platform
$username
$token
$profil_picture_url
N/A
No private methods found
No private properties found
N/A

Properties

$platform

$platform : object

Type

object — The streaming platform

$username

$username : string

Type

string — The streaming platform account username

$token

$token : string

Type

string — The authentication token given by the streaming platform

$profil_picture_url

$profil_picture_url : string

Type

string — The the streaming platform profil picture URL

Methods

__construct()

__construct(string  $platform) 

Parameters

string $platform

The streaming platform

getPlatform()

getPlatform() : object

Returns

object —

Returns the streaming platform

getUsername()

getUsername() : string

Returns

string —

Returns the streaming platform account username

getToken()

getToken() : string

Returns

string —

Returns the authentication token given by the streaming platform

getProfilPictureUrl()

getProfilPictureUrl() : string

Returns

string —

Returns the streaming platform profil picture URL

setToken()

setToken(string  $token) 

Parameters

string $token

The authentication token given by the streaming platform

curlRequest()

curlRequest(string  $url, string|null  $post_data = null, string|null  $http_header = null) : string

Parameters

string $url

URL to send the request to

string|null $post_data

POST data to send

string|null $http_header

HTTP header to set

Returns

string —

Returns http(s) response

cryptToken()

cryptToken(string  $token) : string

Crypt a token

Parameters

string $token

Token to crypt

Returns

string —

The crypted token

decryptToken()

decryptToken(string  $encrypted_token) : string

Decrypt a token

Parameters

string $encrypted_token

The crypted token

Returns

string —

The decrypted token

getTokenFromSource()

getTokenFromSource(array  $data) 

Gets token from Smashcast

Parameters

array $data

Data to pass to the streaming platform API (app token, secret token...)

getUsernameFromSource()

getUsernameFromSource() 

Gets username from Smashcast

getProfilePictureFromSource()

getProfilePictureFromSource() 

Gets profile picture from Smashcast

saveToDB()

saveToDB(\Vigas\StreamingPlatforms\Model\PDO  $db, string  $username, integer  $user_id) : array|false

Saves Smashcast user informations into database

Parameters

\Vigas\StreamingPlatforms\Model\PDO $db

Database connection object

string $username

Streaming platform username

integer $user_id

The Vigas user id

Returns

array|false —

Returns Smashcast username and token if informations have been saved, false otherwise

getFromDB()

getFromDB(\Vigas\StreamingPlatforms\Model\PDO  $db, integer  $user_id) : object

Gets Smashcast user informations from the database

Parameters

\Vigas\StreamingPlatforms\Model\PDO $db

Database connection object

integer $user_id

The Vigas user id

Returns

object —

The Smashcast account