File tree Expand file tree Collapse file tree
caliper/app/Caliper/Traits Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,15 +33,7 @@ protected function getUser(string $id): ?User
3333
3434 public function getAnonymizedUsername (User $ actor ): string
3535 {
36- $ eppnValue = env ('DB_EPPN ' );
37- if (is_bool ($ eppnValue ) && $ eppnValue ) {
38- $ enableEppn = true ;
39- } elseif (is_string ($ eppnValue ) && $ eppnValue == 'true ' ) {
40- $ enableEppn = true ;
41- } else {
42- $ enableEppn = false ;
43- }
44- if ($ enableEppn ) {
36+ if ($ this ->isEnabledEppn ()) {
4537 $ username = ($ actor ->auth === 'lti ' )
4638 ? $ actor ->alternatename
4739 : $ actor ->username ;
@@ -125,4 +117,16 @@ public function getCourseId(string $id): string
125117 {
126118 return env ('APP_URL ' ) . '/course/view.php?id= ' . $ id ;
127119 }
120+
121+ protected function isEnabledEppn (): bool
122+ {
123+ $ eppnValue = env ('DB_EPPN ' );
124+ if (is_bool ($ eppnValue ) && $ eppnValue ) {
125+ return true ;
126+ } elseif (is_string ($ eppnValue ) && $ eppnValue == 'true ' ) {
127+ return true ;
128+ } else {
129+ return false ;
130+ }
131+ }
128132}
You can’t perform that action at this time.
0 commit comments