/**
* Retrieve the previous IdP the user used.
*
* This function overrides the corresponding function in the parent class,
* to add support for common domain cookie.
*
* @return string|NULL The entity id of the previous IdP the user used, or NULL if this is the first time.
*/
protected function getPreviousIdP()
{
if ($this->cdcDomain === NULL) {
return parent::getPreviousIdP();
}
$prevIdPs = $this->getCDC();
while (count($prevIdPs) > 0) {
$idp = array_pop($prevIdPs);
$idp = $this->validateIdP($idp);
if ($idp !== NULL) {
return $idp;
}
}
return NULL;
}