2626 */
2727class APIController extends OCSController {
2828
29- /** @var string */
30- protected $ language ;
29+ protected ?string $ language = null ;
3130
3231 /**
3332 * List of apps that were in the appstore but are now shipped and don't have
@@ -95,7 +94,7 @@ public function getAppList(string $newVersion): DataResponse {
9594 $ this ->appFetcher ->setVersion ($ newVersion , 'future-apps.json ' , false );
9695
9796 // Apps available on the app store for that version
98- $ availableApps = array_map (static function (array $ app ) {
97+ $ availableApps = array_map (static function (array $ app ): string {
9998 return $ app ['id ' ];
10099 }, $ this ->appFetcher ->get ());
101100
@@ -106,8 +105,6 @@ public function getAppList(string $newVersion): DataResponse {
106105 ], Http::STATUS_NOT_FOUND );
107106 }
108107
109- $ this ->language = $ this ->l10nFactory ->getUserLanguage ($ this ->userSession ->getUser ());
110-
111108 // Ignore apps that are deployed from git
112109 $ installedApps = array_filter ($ installedApps , function (string $ appId ) {
113110 try {
@@ -139,14 +136,20 @@ public function getAppList(string $newVersion): DataResponse {
139136 */
140137 protected function getAppDetails (string $ appId ): array {
141138 $ app = $ this ->appManager ->getAppInfo ($ appId , false , $ this ->language );
142- /** @var ?string $name */
143- $ name = $ app ['name ' ];
139+ $ name = $ app ['name ' ] ?? $ appId ;
144140 return [
145141 'appId ' => $ appId ,
146- 'appName ' => $ name ?? $ appId ,
142+ 'appName ' => $ name ,
147143 ];
148144 }
149145
146+ protected function getLanguage (): string {
147+ if ($ this ->language === null ) {
148+ $ this ->language = $ this ->l10nFactory ->getUserLanguage ($ this ->userSession ->getUser ());
149+ }
150+ return $ this ->language ;
151+ }
152+
150153 /**
151154 * Get changelog entry for an app
152155 *
0 commit comments