PHP Class Locker\Helpers\Helpers

Afficher le fichier Open project: learninglocker/learninglocker Class Usage Examples

Méthodes publiques

Méthode Description
checkForNull ( $array ) * |--------------------------------------------------------------------------- | Loop through a statement and check for NULL values.
convertIds ( $models = [] )
getAgentIdentifier ( stdClass $actor ) : String | null Determines which identifier is currently in use in the given actor.
getClient ( String $username, $password ) : Model Checks the authentication.
getCurrentDate ( ) : String Gets the current date and time in ISO format using the current timezone.
getEnvVar ( $var )
getEnvironment ( AssocArray $config, String $givenHost ) : String Gets the environment by matching a given host to a config.
getGravatar ( $email, $size = '50' ) * |--------------------------------------------------------------------------- | Get gravatar |---------------------------------------------------------------------------
getLrsFromAuth ( ) : Locker\Helpers\Lrs Gets the current LRS from the Authorization header.
getLrsFromUserPass ( String $username, String $password ) : Locker\Helpers\Lrs Gets the Lrs associated with the given username and password.
getUserPassFromAuth ( ) : [String] Gets the username and password from the authorization string.
getUserPassFromBAuth ( String $authorization ) : [String] Gets the Client/Lrs username and password from the Basic Auth authorization string.
getUserPassFromOAuth ( String $authorization ) : [String] Gets the Client/Lrs username and password from the OAuth authorization string.
mixedMultipartContentType ( $boundary = null )
replaceFullStop ( $array ) * |--------------------------------------------------------------------------- | Loop through a statement and check keys for full stops, if exist, replace.
replaceFullStopInKeys ( $string ) * |--------------------------------------------------------------------------- | Mongo doesn't allow full stops in keys, so replace with html entity &46; |---------------------------------------------------------------------------
replaceHtmlEntity ( $array, $toArray = false ) * |---------------------------------------------------------------------------- | scan array and replace &46; with . (This is a result of . being | reserved in Mongo) convert array to json as this is faster for | multi-dimensional arrays (?) @todo check this out.
validateAtom ( Locker\XApi\Atom $atom, String $trace = null ) Validates a XAPIAtom.

Method Details

checkForNull() static public méthode

|---------------------------------------------------------------------------
static public checkForNull ( $array )

convertIds() public static méthode

public static convertIds ( $models = [] )

getAgentIdentifier() static public méthode

Determines which identifier is currently in use in the given actor.
static public getAgentIdentifier ( stdClass $actor ) : String | null
$actor stdClass
Résultat String | null Identifier in use.

getClient() static public méthode

Checks the authentication.
static public getClient ( String $username, $password ) : Model
$username String
Résultat Model

getCurrentDate() static public méthode

Gets the current date and time in ISO format using the current timezone.
static public getCurrentDate ( ) : String
Résultat String Current ISO date and time.

getEnvVar() static public méthode

static public getEnvVar ( $var )

getEnvironment() static public méthode

Gets the environment by matching a given host to a config.
static public getEnvironment ( AssocArray $config, String $givenHost ) : String
$config AssocArray Configuration mapping an environment => hosts
$givenHost String A string representing the host.
Résultat String Matched environment from the config.

getGravatar() static public méthode

* |--------------------------------------------------------------------------- | Get gravatar |---------------------------------------------------------------------------
static public getGravatar ( $email, $size = '50' )

getLrsFromAuth() static public méthode

Gets the current LRS from the Authorization header.
static public getLrsFromAuth ( ) : Locker\Helpers\Lrs
Résultat Locker\Helpers\Lrs

getLrsFromUserPass() static public méthode

Gets the Lrs associated with the given username and password.
static public getLrsFromUserPass ( String $username, String $password ) : Locker\Helpers\Lrs
$username String
$password String
Résultat Locker\Helpers\Lrs

getUserPassFromAuth() static public méthode

Gets the username and password from the authorization string.
static public getUserPassFromAuth ( ) : [String]
Résultat [String]

getUserPassFromBAuth() static public méthode

Gets the Client/Lrs username and password from the Basic Auth authorization string.
static public getUserPassFromBAuth ( String $authorization ) : [String]
$authorization String
Résultat [String]

getUserPassFromOAuth() static public méthode

Gets the Client/Lrs username and password from the OAuth authorization string.
static public getUserPassFromOAuth ( String $authorization ) : [String]
$authorization String
Résultat [String]

mixedMultipartContentType() public static méthode

public static mixedMultipartContentType ( $boundary = null )

replaceFullStop() static public méthode

|---------------------------------------------------------------------------
static public replaceFullStop ( $array )

replaceFullStopInKeys() static public méthode

* |--------------------------------------------------------------------------- | Mongo doesn't allow full stops in keys, so replace with html entity &46; |---------------------------------------------------------------------------
static public replaceFullStopInKeys ( $string )

replaceHtmlEntity() static public méthode

|----------------------------------------------------------------------------
static public replaceHtmlEntity ( $array, $toArray = false )

validateAtom() static public méthode

Validates a XAPIAtom.
static public validateAtom ( Locker\XApi\Atom $atom, String $trace = null )
$atom Locker\XApi\Atom Atom to be validated.
$trace String Where the atom has came from (i.e. request parameter name).