Locker\Helpers\Helpers::getLrsFromUserPass PHP Méthode

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
    static function getLrsFromUserPass($username, $password)
    {
        $client = Helpers::getClient($username, $password);
        $lrs = $client === null ? null : \Lrs::find($client->lrs_id);
        if ($lrs === null) {
            throw new Exceptions\Exception('Unauthorized request.', 401);
        }
        return $lrs;
    }

Usage Example

 /**
  * Gets the current LRS from the Authorization header.
  * @return \Lrs
  */
 static function getLrsFromAuth()
 {
     list($username, $password) = Helpers::getUserPassFromAuth();
     return Helpers::getLrsFromUserPass($username, $password);
 }