MCPcopy Create free account
hub / github.com/Rello/analytics / get

Method get

lib/Controller/WhatsNewController.php:55–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 }
54
55 #[NoAdminRequired]
56 public function get(): DataResponse
57 {
58 $user = $this->userSession->getUser();
59 if ($user === null) {
60 throw new \RuntimeException("Acting user cannot be resolved");
61 }
62 $lastRead = $this->config->getUserValue($user->getUID(), $this->appName, 'whatsNewLastRead', 0);
63 $currentVersion = $this->whatsNewService->normalizeVersion($this->config->getAppValue($this->appName, 'installed_version'));
64
65 if (version_compare($lastRead, $currentVersion, '>=')) {
66 return new DataResponse([], Http::STATUS_NO_CONTENT);
67 }
68
69 try {
70 $iterator = $this->langFactory->getLanguageIterator();
71 $whatsNew = $this->whatsNewService->getChangesForVersion($currentVersion);
72
73 $resultData = [
74 'changelogURL' => $whatsNew['changelogURL'],
75 'product' => 'Analytics',
76 'version' => $currentVersion,
77 ];
78 do {
79 $lang = $iterator->current();
80 if (isset($whatsNew['whatsNew'][$lang])) {
81 $resultData['whatsNew'] = $whatsNew['whatsNew'][$lang];
82 break;
83 }
84 $iterator->next();
85 } while ($lang !== 'en' && $iterator->valid());
86 return new DataResponse($resultData);
87 } catch (DoesNotExistException $e) {
88 return new DataResponse([], Http::STATUS_NO_CONTENT);
89 }
90 }
91
92 /**
93 *

Callers 15

getValuesMethod · 0.45
setValueMethod · 0.45
removeValueMethod · 0.45
queryChangesServerMethod · 0.45
mainMethod · 0.45
readDataMethod · 0.45
readDataMethod · 0.45
readDataMethod · 0.45
getNameMethod · 0.45
prepareMethod · 0.45

Calls 4

normalizeVersionMethod · 0.80
getChangesForVersionMethod · 0.80
validMethod · 0.80
getUIDMethod · 0.45

Tested by

no test coverage detected