33namespace SimpleSAML \Module \drupalauth ;
44
55use SimpleSAML \Configuration ;
6- use SimpleSAML \Utils \Config ;
76
87/**
98 * Drupal authentication source configuration parser.
@@ -16,39 +15,39 @@ class ConfigHelper
1615 * String with the location of this configuration.
1716 * Used for error reporting.
1817 */
19- private $ location ;
18+ private string $ location ;
2019
2120
2221 /**
2322 * The filesystem path to the Drupal directory
2423 */
25- private $ drupalroot ;
24+ private string $ drupalroot ;
2625
2726
2827 /**
2928 * Whether debug output is enabled.
3029 *
3130 * @var bool
3231 */
33- private $ debug ;
32+ private bool $ debug ;
3433
3534
3635 /**
3736 * The attributes we should fetch. Can be NULL in which case we will fetch all attributes.
3837 */
39- private $ attributes ;
38+ private ? array $ attributes ;
4039
4140
4241 /**
4342 * The Drupal logout URL
4443 */
45- private $ drupal_logout_url ;
44+ private string $ drupal_logout_url ;
4645
4746
4847 /**
4948 * The Drupal login URL
5049 */
51- private $ drupal_login_url ;
50+ private string $ drupal_login_url ;
5251
5352
5453 /**
@@ -57,7 +56,7 @@ class ConfigHelper
5756 * @param array $config Configuration.
5857 * @param string $location The location of this configuration. Used for error reporting.
5958 */
60- public function __construct ($ config , $ location ) {
59+ public function __construct (array $ config , string $ location ) {
6160 assert (is_array ($ config ));
6261 assert (is_string ($ location ));
6362
@@ -66,19 +65,19 @@ public function __construct($config, $location) {
6665 /* Get authsource configuration. */
6766 $ config = Configuration::loadFromArray ($ config , $ location );
6867
69- $ this ->drupalroot = $ config ->getString ('drupalroot ' );
70- $ this ->debug = $ config ->getBoolean ('debug ' , FALSE );
71- $ this ->attributes = $ config ->getArray ('attributes ' , [] );
72- $ this ->drupal_logout_url = $ config ->getString ('drupal_logout_url ' , NULL );
73- $ this ->drupal_login_url = $ config ->getString ('drupal_login_url ' , NULL );
68+ $ this ->drupalroot = $ config ->getString ('drupalroot ' );
69+ $ this ->debug = $ config ->getOptionalBoolean ('debug ' , false );
70+ $ this ->attributes = $ config ->getOptionalArray ('attributes ' , null );
71+ $ this ->drupal_logout_url = $ config ->getString ('drupal_logout_url ' );
72+ $ this ->drupal_login_url = $ config ->getString ('drupal_login_url ' );
7473 }
7574
7675 /**
7776 * Returns debug mode.
7877 *
79- * @return boolean
78+ * @return bool
8079 */
81- public function getDebug ()
80+ public function getDebug (): bool
8281 {
8382 return $ this ->debug ;
8483 }
@@ -88,7 +87,7 @@ public function getDebug()
8887 *
8988 * @return string
9089 */
91- public function getDrupalroot ()
90+ public function getDrupalroot (): string
9291 {
9392 return $ this ->drupalroot ;
9493 }
@@ -98,7 +97,7 @@ public function getDrupalroot()
9897 *
9998 * @return array
10099 */
101- public function getAttributes ()
100+ public function getAttributes (): ? array
102101 {
103102 return $ this ->attributes ;
104103 }
@@ -109,7 +108,7 @@ public function getAttributes()
109108 *
110109 * @return string
111110 */
112- public function getDrupalLogoutURL ()
111+ public function getDrupalLogoutURL (): string
113112 {
114113 return $ this ->drupal_logout_url ;
115114 }
@@ -119,7 +118,7 @@ public function getDrupalLogoutURL()
119118 *
120119 * @return string
121120 */
122- public function getDrupalLoginURL ()
121+ public function getDrupalLoginURL (): string
123122 {
124123 return $ this ->drupal_login_url ;
125124 }
0 commit comments