@@ -117,6 +117,7 @@ public function run(array $params): int
117
117
118
118
return 1 ;
119
119
}
120
+
120
121
// @TODO execute() is deprecated in CI v4.3.0.
121
122
$ this ->execute ($ params ); // @phpstan-ignore-line suppress deprecated error.
122
123
@@ -136,20 +137,21 @@ private function updateConfig($className): int
136
137
return 1 ;
137
138
}
138
139
139
- // Add the code
140
- $ codeKey = strtolower (str_replace ('OAuth ' , '' , $ className ));
141
- $ codeName = ucfirst (str_replace ('OAuth ' , '' , $ className ));
142
- $ code = "' {$ codeKey }' => [
143
- 'client_id' => 'Get it from {$ codeName }',
144
- 'client_secret' => 'Get it from {$ codeName }',
140
+ // Create the new config items to be added
141
+ $ oauthKey = strtolower (str_replace ('OAuth ' , '' , $ className ));
142
+ $ oauthName = ucfirst (str_replace ('OAuth ' , '' , $ className ));
143
+ $ code = "' {$ oauthKey }' => [
144
+ 'client_id' => 'Get it from {$ oauthName }',
145
+ 'client_secret' => 'Get it from {$ oauthName }',
145
146
146
147
'allow_login' => true,
147
148
], " ;
148
149
149
- // Add helper setup
150
+ // Setup the process of adding the code to the config file
150
151
$ pattern = '/( ' . preg_quote ('public array $oauthConfigs = [ ' , '/ ' ) . ')/u ' ;
151
152
$ replace = '$1 ' . "\n " . $ code ;
152
153
154
+ // Add the code
153
155
$ this ->add ($ file , $ code , $ pattern , $ replace );
154
156
155
157
return 0 ;
0 commit comments