PHP Class Locker\Helpers\Helpers

Datei anzeigen Open project: learninglocker/learninglocker Class Usage Examples

Public Methods

Method 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 method

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

convertIds() public static method

public static convertIds ( $models = [] )

getAgentIdentifier() static public method

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

getClient() static public method

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

getCurrentDate() static public method

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

getEnvVar() static public method

static public getEnvVar ( $var )

getEnvironment() static public method

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.
return String Matched environment from the config.

getGravatar() static public method

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

getLrsFromAuth() static public method

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

getLrsFromUserPass() static public method

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

getUserPassFromAuth() static public method

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

getUserPassFromBAuth() static public method

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

getUserPassFromOAuth() static public method

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

mixedMultipartContentType() public static method

public static mixedMultipartContentType ( $boundary = null )

replaceFullStop() static public method

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

replaceFullStopInKeys() static public method

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

replaceHtmlEntity() static public method

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

validateAtom() static public method

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).