3
3
namespace SimpleSAML \Module \drupalauth ;
4
4
5
5
use SimpleSAML \Configuration ;
6
- use SimpleSAML \Utils \Config ;
7
6
8
7
/**
9
8
* Drupal authentication source configuration parser.
@@ -16,39 +15,39 @@ class ConfigHelper
16
15
* String with the location of this configuration.
17
16
* Used for error reporting.
18
17
*/
19
- private $ location ;
18
+ private string $ location ;
20
19
21
20
22
21
/**
23
22
* The filesystem path to the Drupal directory
24
23
*/
25
- private $ drupalroot ;
24
+ private string $ drupalroot ;
26
25
27
26
28
27
/**
29
28
* Whether debug output is enabled.
30
29
*
31
30
* @var bool
32
31
*/
33
- private $ debug ;
32
+ private bool $ debug ;
34
33
35
34
36
35
/**
37
36
* The attributes we should fetch. Can be NULL in which case we will fetch all attributes.
38
37
*/
39
- private $ attributes ;
38
+ private ? array $ attributes ;
40
39
41
40
42
41
/**
43
42
* The Drupal logout URL
44
43
*/
45
- private $ drupal_logout_url ;
44
+ private string $ drupal_logout_url ;
46
45
47
46
48
47
/**
49
48
* The Drupal login URL
50
49
*/
51
- private $ drupal_login_url ;
50
+ private string $ drupal_login_url ;
52
51
53
52
54
53
/**
@@ -57,7 +56,7 @@ class ConfigHelper
57
56
* @param array $config Configuration.
58
57
* @param string $location The location of this configuration. Used for error reporting.
59
58
*/
60
- public function __construct ($ config , $ location ) {
59
+ public function __construct (array $ config , string $ location ) {
61
60
assert (is_array ($ config ));
62
61
assert (is_string ($ location ));
63
62
@@ -66,19 +65,19 @@ public function __construct($config, $location) {
66
65
/* Get authsource configuration. */
67
66
$ config = Configuration::loadFromArray ($ config , $ location );
68
67
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 ' );
74
73
}
75
74
76
75
/**
77
76
* Returns debug mode.
78
77
*
79
- * @return boolean
78
+ * @return bool
80
79
*/
81
- public function getDebug ()
80
+ public function getDebug (): bool
82
81
{
83
82
return $ this ->debug ;
84
83
}
@@ -88,7 +87,7 @@ public function getDebug()
88
87
*
89
88
* @return string
90
89
*/
91
- public function getDrupalroot ()
90
+ public function getDrupalroot (): string
92
91
{
93
92
return $ this ->drupalroot ;
94
93
}
@@ -98,7 +97,7 @@ public function getDrupalroot()
98
97
*
99
98
* @return array
100
99
*/
101
- public function getAttributes ()
100
+ public function getAttributes (): ? array
102
101
{
103
102
return $ this ->attributes ;
104
103
}
@@ -109,7 +108,7 @@ public function getAttributes()
109
108
*
110
109
* @return string
111
110
*/
112
- public function getDrupalLogoutURL ()
111
+ public function getDrupalLogoutURL (): string
113
112
{
114
113
return $ this ->drupal_logout_url ;
115
114
}
@@ -119,7 +118,7 @@ public function getDrupalLogoutURL()
119
118
*
120
119
* @return string
121
120
*/
122
- public function getDrupalLoginURL ()
121
+ public function getDrupalLoginURL (): string
123
122
{
124
123
return $ this ->drupal_login_url ;
125
124
}
0 commit comments