3939 */
4040class user_folder_access {
4141 use webdav_client_trait;
42+
4243 /**
4344 * Additional scopes needed by the user account. Currently, ownCloud does not actually support/use scopes, so
4445 * this is intended as a hint at required functionality and will help declare future scopes.
@@ -76,7 +77,7 @@ class user_folder_access {
7677 * @param \moodle_url $oauthloginreturnurl URL that will be redirected to after the login callback has succeeded.
7778 * @throws configuration_exception If essential data is missing.
7879 */
79- public function __construct (\moodle_url $ oauthloginreturnurl ) {
80+ public function __construct (\moodle_url $ oauthloginreturnurl ) {
8081 // Get issuer and system account client. Fail early, if needed.
8182 $ selectedissuer = get_config ("collaborativefolders " , "issuerid " );
8283 if (empty ($ selectedissuer )) {
@@ -97,7 +98,6 @@ public function __construct (\moodle_url $oauthloginreturnurl) {
9798 if (!$ this ->userclient ) {
9899 throw new configuration_exception (get_string ('incompletedata ' , 'mod_collaborativefolders ' ));
99100 }
100-
101101 }
102102
103103 /**
@@ -130,16 +130,14 @@ public function rename($pathtofolder, $newname) {
130130
131131 $ renamed = null ;
132132
133- $ ret = array () ;
133+ $ ret = [] ;
134134
135135 if ($ this ->webdav ->open ()) {
136-
137136 // After the socket's opening, the WebDAV MOVE method has to be performed in
138137 // order to rename the folder.
139138 // TODO check number of slashes in `dst_path`.
140- $ renamed = $ this ->webdav ->move ($ this ->davbasepath . $ pathtofolder , $ this ->davbasepath . '/ ' . $ newname , false );
139+ $ renamed = $ this ->webdav ->move ($ this ->davbasepath . $ pathtofolder , $ this ->davbasepath . '/ ' . $ newname , false );
141140 } else {
142-
143141 // If the socket could not be opened, a socket error needs to be returned.
144142 $ ret ['status ' ] = false ;
145143 $ ret ['content ' ] = get_string ('socketerror ' , 'mod_collaborativefolders ' );
@@ -151,7 +149,6 @@ public function rename($pathtofolder, $newname) {
151149 $ ret ['status ' ] = true ;
152150 return $ ret ;
153151 } else {
154-
155152 // If the WebDAV operation failed, a error message, containing the specific response code,
156153 // is returned.
157154 $ ret ['status ' ] = false ;
@@ -183,7 +180,7 @@ public function get_login_url() {
183180 *
184181 * @return bool false, if no Access Token is set or can be requested.
185182 */
186- public function check_login () : bool {
183+ public function check_login (): bool {
187184 if (!$ this ->userclient ->is_logged_in ()) {
188185 self ::clear_userinfo_cache ();
189186 return false ;
@@ -205,11 +202,11 @@ public function store_link($cmid, $groupid, $userid, $value) {
205202 // TODO use persistent API instead.
206203 global $ DB ;
207204
208- $ params = array (
205+ $ params = [
209206 'cmid ' => $ cmid ,
210207 'groupid ' => $ groupid ,
211208 'userid ' => $ userid ,
212- ) ;
209+ ] ;
213210
214211 $ record = $ DB ->get_record ('collaborativefolders_link ' , $ params );
215212
@@ -240,11 +237,11 @@ public function get_link($cmid, $groupid, $userid) {
240237 // TODO use persistent API instead.
241238 global $ DB ;
242239
243- $ params = array (
240+ $ params = [
244241 'cmid ' => $ cmid ,
245242 'groupid ' => $ groupid ,
246243 'userid ' => $ userid ,
247- ) ;
244+ ] ;
248245
249246 return $ DB ->get_record ('collaborativefolders_link ' , $ params );
250247 }
@@ -253,7 +250,7 @@ public function get_link($cmid, $groupid, $userid) {
253250 * Get the session cache that stores the user info, to save on repeated webservice calls.
254251 * @return \cache
255252 */
256- private static function get_userinfo_cache () : \cache {
253+ private static function get_userinfo_cache (): \cache {
257254 return \cache::make ('mod_collaborativefolders ' , 'userinfo ' );
258255 }
259256
@@ -290,8 +287,8 @@ public function get_username() {
290287 * @param string $foldername Name of a folder
291288 * @return string URL where the folder should be found
292289 */
293- public function link_from_foldername ($ foldername ) : string {
294- $ baseurl = rtrim ($ this ->issuer ->get ('baseurl ' ), '/ ' ). '/ ' ;
290+ public function link_from_foldername ($ foldername ): string {
291+ $ baseurl = rtrim ($ this ->issuer ->get ('baseurl ' ), '/ ' ) . '/ ' ;
295292 return sprintf ('%sindex.php/apps/files/?dir=/%s ' , $ baseurl , urlencode ($ foldername ));
296293 }
297294}
0 commit comments