\cheetahBetManager

Class BetManager This class contains various methods to manage bets.

Summary

Methods
Properties
Constants
__construct()
getAllBetsForUser()
getAllBetsForUserOnMatchday()
placeBetWithoutAuthentication()
placeBetWithLoginSession()
placeBetWithApiKey()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct(\mysqli  $db) 

BetManager constructor.

Stores a mysqli connection to interface with the database

Parameters

\mysqli $db

getAllBetsForUser()

getAllBetsForUser(\welwitschi\User  $user) : \cheetah\array:

Retrieves all bets for a specific user

Parameters

\welwitschi\User $user

Returns

\cheetah\array: —

An array of bets with the bet IDs acting as keys

getAllBetsForUserOnMatchday()

getAllBetsForUserOnMatchday(\welwitschi\User  $user, \cheetah\int  $matchday) : \cheetah\array:

Retrieves all matches for a user on a specified matchday

Parameters

\welwitschi\User $user
\cheetah\int $matchday

Returns

\cheetah\array: —

A List of Bets that qualify for the given parameters

placeBetWithoutAuthentication()

placeBetWithoutAuthentication(\welwitschi\User  $user, \cheetah\Match  $match, \cheetah\int  $homeScore, \cheetah\int  $awayScore) : \cheetah\bool:

Places a bet on behalf of a user without any authentication needed.

Should generally not be used from outside this class.

Parameters

\welwitschi\User $user
\cheetah\Match $match
\cheetah\int $homeScore
\cheetah\int $awayScore

Returns

\cheetah\bool: —

true if the bet was placed successfully, false if not. Bets will fail if the match has already started

placeBetWithLoginSession()

placeBetWithLoginSession(\welwitschi\User  $user, \cheetah\Match  $match, \cheetah\int  $homeScore, \cheetah\int  $awayScore) : \cheetah\bool:

Places a bet for a logged in User

Parameters

\welwitschi\User $user
\cheetah\Match $match
\cheetah\int $homeScore
\cheetah\int $awayScore

Returns

\cheetah\bool: —

true if the bet was places successfully, else false

placeBetWithApiKey()

placeBetWithApiKey(\welwitschi\User  $user, \cheetah\string  $apiKey, \cheetah\Match  $match, \cheetah\int  $homeScore, \cheetah\int  $awayScore) : \cheetah\bool:

Places a bet using an API key as authentication

Parameters

\welwitschi\User $user
\cheetah\string $apiKey
\cheetah\Match $match
\cheetah\int $homeScore
\cheetah\int $awayScore

Returns

\cheetah\bool: —

true if the bet placing was successful, false otherwise