MDL-71017 oath2: configuration check fix and return types

This commit is contained in:
Marina Glancy 2021-04-20 12:07:54 +02:00
parent 5a6f05c605
commit 57a444d31f
4 changed files with 10 additions and 9 deletions

View file

@ -111,11 +111,12 @@ class api {
/**
* List all the issuers, ordered by the sortorder field
*
* @param bool $showall also include issues that are configured to be shown only on login page
* @param bool $includeloginonly also include issuers that are configured to be shown only on login page,
* By default false, in this case the method returns all issuers that can be used in services
* @return \core\oauth2\issuer[]
*/
public static function get_all_issuers(bool $showall = false) {
if ($showall) {
public static function get_all_issuers(bool $includeloginonly = false) {
if ($includeloginonly) {
return issuer::get_records([], 'sortorder');
} else {
return array_values(issuer::get_records_select('showonloginpage<>?', [issuer::LOGINONLY], 'sortorder'));

View file

@ -196,7 +196,7 @@ class issuer extends persistent {
* @return bool
* @throws \coding_exception
*/
public function is_available_for_login() {
public function is_available_for_login(): bool {
return $this->get('id') &&
$this->is_configured() &&
$this->get('showonloginpage') != self::SERVICEONLY &&
@ -265,7 +265,7 @@ class issuer extends persistent {
*
* @return string
*/
public function get_display_name() {
public function get_display_name(): string {
return $this->get('loginpagename') ? $this->get('loginpagename') : $this->get('name');
}
}