phpstormify

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier 2021-06-24 13:48:09 +02:00
parent 9fd4a6ab34
commit 60c91bdc67
No known key found for this signature in database
GPG key ID: 4141FEE162030638
12 changed files with 219 additions and 224 deletions

View file

@ -9,16 +9,13 @@
namespace OCA\Moodle\AppInfo;
use OCP\IContainer;
use OCP\IConfig;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCA\Moodle\Controller\PageController;
use OCA\Moodle\Dashboard\MoodleWidget;
use OCA\Moodle\Search\MoodleSearchCoursesProvider;
use OCA\Moodle\Search\MoodleSearchModulesProvider;
@ -32,6 +29,10 @@ use OCA\Moodle\Search\MoodleSearchUpcomingProvider;
class Application extends App implements IBootstrap {
public const APP_ID = 'integration_moodle';
/**
* @var mixed
*/
private $config;
/**
* Constructor
@ -42,7 +43,7 @@ class Application extends App implements IBootstrap {
parent::__construct(self::APP_ID, $urlParams);
$container = $this->getContainer();
$this->config = $container->query(IConfig::class);
$this->config = $container->get(IConfig::class);
}
public function register(IRegistrationContext $context): void {

View file

@ -11,58 +11,31 @@
namespace OCA\Moodle\Controller;
use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\IURLGenerator;
use OCP\IConfig;
use OCP\IServerContainer;
use OCP\IL10N;
use Psr\Log\LoggerInterface;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\IRequest;
use OCP\IDBConnection;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
use OCA\Moodle\Service\MoodleAPIService;
use OCA\Moodle\AppInfo\Application;
class ConfigController extends Controller {
private $userId;
/**
* @var IConfig
*/
private $config;
private $dbconnection;
private $dbtype;
/**
* @var string|null
*/
private $userId;
public function __construct($AppName,
public function __construct(string $appName,
IRequest $request,
IServerContainer $serverContainer,
IConfig $config,
IAppManager $appManager,
IAppData $appData,
IDBConnection $dbconnection,
IURLGenerator $urlGenerator,
IL10N $l,
LoggerInterface $logger,
MoodleAPIService $moodleAPIService,
$userId) {
parent::__construct($AppName, $request);
$this->l = $l;
$this->userId = $userId;
$this->appData = $appData;
$this->serverContainer = $serverContainer;
?string $userId) {
parent::__construct($appName, $request);
$this->config = $config;
$this->dbconnection = $dbconnection;
$this->urlGenerator = $urlGenerator;
$this->logger = $logger;
$this->moodleAPIService = $moodleAPIService;
$this->userId = $userId;
}
/**
@ -81,8 +54,7 @@ class ConfigController extends Controller {
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'user_name');
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'privatetoken');
}
$response = new DataResponse(1);
return $response;
return new DataResponse(1);
}
/**
@ -95,7 +67,6 @@ class ConfigController extends Controller {
foreach ($values as $key => $value) {
$this->config->setAppValue(Application::APP_ID, $key, $value);
}
$response = new DataResponse(1);
return $response;
return new DataResponse(1);
}
}

View file

@ -11,21 +11,8 @@
namespace OCA\Moodle\Controller;
use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\IURLGenerator;
use OCP\IConfig;
use OCP\IServerContainer;
use OCP\IL10N;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use Psr\Log\LoggerInterface;
use OCP\IRequest;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
@ -35,32 +22,42 @@ use OCA\Moodle\AppInfo\Application;
class MoodleAPIController extends Controller {
private $userId;
/**
* @var IConfig
*/
private $config;
private $dbconnection;
private $dbtype;
/**
* @var MoodleAPIService
*/
private $moodleAPIService;
/**
* @var string|null
*/
private $userId;
/**
* @var string
*/
private $accessToken;
/**
* @var string
*/
private $moodleUrl;
/**
* @var bool
*/
private $checkSsl;
public function __construct($AppName,
public function __construct(string $appName,
IRequest $request,
IServerContainer $serverContainer,
IConfig $config,
IL10N $l10n,
IAppManager $appManager,
IAppData $appData,
LoggerInterface $logger,
MoodleAPIService $moodleAPIService,
$userId) {
parent::__construct($AppName, $request);
$this->userId = $userId;
$this->l10n = $l10n;
$this->appData = $appData;
$this->serverContainer = $serverContainer;
?string $userId) {
parent::__construct($appName, $request);
$this->config = $config;
$this->logger = $logger;
$this->moodleAPIService = $moodleAPIService;
$this->accessToken = $this->config->getUserValue($this->userId, Application::APP_ID, 'token', '');
$this->moodleUrl = $this->config->getUserValue($this->userId, Application::APP_ID, 'url', '');
$this->userId = $userId;
$this->accessToken = $this->config->getUserValue($this->userId, Application::APP_ID, 'token');
$this->moodleUrl = $this->config->getUserValue($this->userId, Application::APP_ID, 'url');
$this->checkSsl = $this->config->getUserValue($this->userId, Application::APP_ID, 'check_ssl', '1') === '1';
}

View file

@ -27,16 +27,22 @@ use OCP\Dashboard\IWidget;
use OCP\IL10N;
use OCA\Moodle\AppInfo\Application;
use OCP\IURLGenerator;
use OCP\Util;
class MoodleWidget implements IWidget {
/** @var IL10N */
private $l10n;
/**
* @var IURLGenerator
*/
private $url;
public function __construct(
IL10N $l10n
) {
public function __construct(IL10N $l10n,
IURLGenerator $url) {
$this->l10n = $l10n;
$this->url = $url;
}
/**
@ -71,14 +77,14 @@ class MoodleWidget implements IWidget {
* @inheritDoc
*/
public function getUrl(): ?string {
return \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => 'connected-accounts']);
return $this->url->linkToRoute('settings.PersonalSettings.index', ['section' => 'connected-accounts']);
}
/**
* @inheritDoc
*/
public function load(): void {
\OC_Util::addScript(Application::APP_ID, Application::APP_ID . '-dashboard');
\OC_Util::addStyle(Application::APP_ID, 'dashboard');
Util::addScript(Application::APP_ID, Application::APP_ID . '-dashboard');
Util::addStyle(Application::APP_ID, 'dashboard');
}
}
}

View file

@ -45,6 +45,14 @@ class MoodleSearchCoursesProvider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
/**
* @var IConfig
*/
private $config;
/**
* @var MoodleAPIService
*/
private $service;
/**
* CospendSearchProvider constructor.
@ -105,13 +113,13 @@ class MoodleSearchCoursesProvider implements IProvider {
$offset = $query->getCursor();
$offset = $offset ? intval($offset) : 0;
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme', '');
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme');
$thumbnailUrl = ($theme === 'dark') ?
$this->urlGenerator->imagePath(Application::APP_ID, 'app.svg') :
$this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg');
$moodleUrl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'url', '');
$accessToken = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'token', '');
$moodleUrl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'url');
$accessToken = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'token');
$checkSsl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'check_ssl', '1') === '1';
$searchCoursesEnabled = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'search_courses_enabled', '0') === '1';
if ($accessToken === '' || !$searchCoursesEnabled) {
@ -123,7 +131,7 @@ class MoodleSearchCoursesProvider implements IProvider {
return SearchResult::paginated($this->getName(), [], 0);
}
$formattedResults = \array_map(function (array $entry) use ($thumbnailUrl, $moodleUrl): MoodleSearchResultEntry {
$formattedResults = array_map(function (array $entry) use ($thumbnailUrl, $moodleUrl): MoodleSearchResultEntry {
return new MoodleSearchResultEntry(
$thumbnailUrl,
$this->getMainText($entry),
@ -166,4 +174,4 @@ class MoodleSearchCoursesProvider implements IProvider {
return $url . '/course/view.php?id=' . $entry['id'];
}
}
}

View file

@ -45,12 +45,21 @@ class MoodleSearchModulesProvider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
/**
* @var IConfig
*/
private $config;
/**
* @var MoodleAPIService
*/
private $service;
/**
* CospendSearchProvider constructor.
*
* @param IAppManager $appManager
* @param IL10N $l10n
* @param IConfig $config
* @param IURLGenerator $urlGenerator
* @param MoodleAPIService $service
*/
@ -105,13 +114,13 @@ class MoodleSearchModulesProvider implements IProvider {
$offset = $query->getCursor();
$offset = $offset ? intval($offset) : 0;
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme', '');
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme');
$thumbnailUrl = ($theme === 'dark') ?
$this->urlGenerator->imagePath(Application::APP_ID, 'app.svg') :
$this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg');
$moodleUrl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'url', '');
$accessToken = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'token', '');
$moodleUrl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'url');
$accessToken = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'token');
$checkSsl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'check_ssl', '1') === '1';
$searchModulesEnabled = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'search_modules_enabled', '0') === '1';
if ($accessToken === '' || !$searchModulesEnabled) {
@ -123,7 +132,7 @@ class MoodleSearchModulesProvider implements IProvider {
return SearchResult::paginated($this->getName(), [], 0);
}
$formattedResults = \array_map(function (array $entry) use ($thumbnailUrl, $moodleUrl): MoodleSearchResultEntry {
$formattedResults = array_map(function (array $entry) use ($thumbnailUrl, $moodleUrl): MoodleSearchResultEntry {
return new MoodleSearchResultEntry(
$this->getThumbnailUrl($entry, $thumbnailUrl),
$this->getMainText($entry),
@ -183,8 +192,8 @@ class MoodleSearchModulesProvider implements IProvider {
*/
protected function getThumbnailurl(array $entry, string $thumbnailUrl): string {
return $thumbnailUrl;
return $entry['modicon']
? $this->urlGenerator->linkToRoute('integration_moodle.moodleAPI.getMoodleAvatar', []) . '?url=' . urlencode($entry['modicon'])
: $thumbnailUrl;
// return $entry['modicon']
// ? $this->urlGenerator->linkToRoute('integration_moodle.moodleAPI.getMoodleAvatar', []) . '?url=' . urlencode($entry['modicon'])
// : $thumbnailUrl;
}
}
}

View file

@ -45,12 +45,21 @@ class MoodleSearchUpcomingProvider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
/**
* @var IConfig
*/
private $config;
/**
* @var MoodleAPIService
*/
private $service;
/**
* CospendSearchProvider constructor.
*
* @param IAppManager $appManager
* @param IL10N $l10n
* @param IConfig $config
* @param IURLGenerator $urlGenerator
* @param MoodleAPIService $service
*/
@ -105,13 +114,13 @@ class MoodleSearchUpcomingProvider implements IProvider {
$offset = $query->getCursor();
$offset = $offset ? intval($offset) : 0;
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme', '');
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme');
$thumbnailUrl = ($theme === 'dark') ?
$this->urlGenerator->imagePath(Application::APP_ID, 'app.svg') :
$this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg');
$moodleUrl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'url', '');
$accessToken = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'token', '');
$moodleUrl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'url');
$accessToken = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'token');
$checkSsl = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'check_ssl', '1') === '1';
$searchUpcomingEnabled = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'search_upcoming_enabled', '0') === '1';
if ($accessToken === '' || !$searchUpcomingEnabled) {
@ -123,7 +132,7 @@ class MoodleSearchUpcomingProvider implements IProvider {
return SearchResult::paginated($this->getName(), [], 0);
}
$formattedResults = \array_map(function (array $entry) use ($thumbnailUrl, $moodleUrl): MoodleSearchResultEntry {
$formattedResults = array_map(function (array $entry) use ($thumbnailUrl, $moodleUrl): MoodleSearchResultEntry {
return new MoodleSearchResultEntry(
$this->getThumbnailUrl($entry, $thumbnailUrl),
$this->getMainText($entry),
@ -175,4 +184,4 @@ class MoodleSearchUpcomingProvider implements IProvider {
? $entry['course']['courseimage']
: $thumbnailUrl;
}
}
}

View file

@ -11,36 +11,46 @@
namespace OCA\Moodle\Service;
use Exception;
use OCP\IL10N;
use Psr\Log\LoggerInterface;
use OCP\Http\Client\IClientService;
use OCA\Moodle\AppInfo\Application;
class MoodleAPIService {
private $l10n;
/**
* @var string
*/
private $appName;
/**
* @var LoggerInterface
*/
private $logger;
/**
* @var IL10N
*/
private $l10n;
/**
* @var \OCP\Http\Client\IClient
*/
private $client;
/**
* Service to make requests to Moodle v1 API
*/
public function __construct (
string $appName,
LoggerInterface $logger,
IL10N $l10n,
IClientService $clientService
) {
public function __construct (string $appName,
LoggerInterface $logger,
IL10N $l10n,
IClientService $clientService) {
$this->appName = $appName;
$this->l10n = $l10n;
$this->logger = $logger;
$this->clientService = $clientService;
$this->l10n = $l10n;
$this->client = $clientService->newClient();
}
/**
* @param string $url
* @param string $accessToken
* @param bool $checkSsl
* @param ?int $recentSince
* @return array
*/
@ -57,7 +67,7 @@ class MoodleAPIService {
}
// sort recent items by date DESC
$a = usort($recentItems, function($a, $b) {
usort($recentItems, function($a, $b) {
$ta = $a['timeaccess'] ?? 0;
$tb = $b['timeaccess'] ?? 0;
return ($ta > $tb) ? -1 : 1;
@ -87,7 +97,7 @@ class MoodleAPIService {
}
}
// sort upcoming events by date ASC
$a = usort($upcomingEvents, function($a, $b) {
usort($upcomingEvents, function($a, $b) {
$ta = $a['timestart'] ?? 0;
$tb = $b['timestart'] ?? 0;
return ($ta < $tb) ? -1 : 1;
@ -115,6 +125,7 @@ class MoodleAPIService {
/**
* @param string $url
* @param string $accessToken
* @param bool $checkSsl
* @param string $query
* @param int $offset
* @param int $limit
@ -160,8 +171,8 @@ class MoodleAPIService {
if ($sections['exception'] || $sections['error']) {
return $sections;
}
foreach ($sections as $k => $section) {
foreach ($section['modules'] as $k => $module) {
foreach ($sections as $ks => $section) {
foreach ($section['modules'] as $km => $module) {
$moduleName = strtolower($module['name']);
if (strpos($moduleName, $query) !== false) {
$module['section_name'] = $section['name'];
@ -181,6 +192,7 @@ class MoodleAPIService {
/**
* @param string $url
* @param string $accessToken
* @param bool $checkSsl
* @param string $query
* @param int $offset
* @param int $limit
@ -228,7 +240,9 @@ class MoodleAPIService {
/**
* @param string $url
* @param bool $checkSsl
* @return string
* @throws Exception
*/
public function getMoodleAvatar(string $url, bool $checkSsl): string {
if ($checkSsl) {
@ -255,6 +269,7 @@ class MoodleAPIService {
/**
* @param string $url
* @param string $endPoint
* @param bool $checkSsl
* @param array $params
* @param string $method
* @return array
@ -299,6 +314,8 @@ class MoodleAPIService {
$response = $this->client->put($url, $options);
} else if ($method === 'DELETE') {
$response = $this->client->delete($url, $options);
} else {
return ['error' => $this->l10n->t('Bad HTTP method')];
}
$body = $response->getBody();
$respCode = $response->getStatusCode();
@ -308,7 +325,7 @@ class MoodleAPIService {
} else {
return json_decode($body, true);
}
} catch (\Exception $e) {
} catch (Exception $e) {
$this->logger->warning('Moodle API error : '.$e, array('app' => $this->appName));
return ['error' => $e->getMessage()];
}
@ -318,6 +335,7 @@ class MoodleAPIService {
* @param string $moodleUrl
* @param string $login
* @param string $password
* @param bool $checkSsl
* @return array
*/
public function getToken(string $moodleUrl, string $login, string $password, bool $checkSsl): array {

View file

@ -2,38 +2,27 @@
namespace OCA\Moodle\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCP\IL10N;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\Settings\ISettings;
use OCP\Util;
use OCP\IURLGenerator;
use OCP\IInitialStateService;
use OCA\Moodle\AppInfo\Application;
class Admin implements ISettings {
private $request;
/**
* @var IConfig
*/
private $config;
private $dataDirPath;
private $urlGenerator;
private $l;
/**
* @var IInitialState
*/
private $initialStateService;
public function __construct(string $appName,
IL10N $l,
IRequest $request,
IConfig $config,
IURLGenerator $urlGenerator,
IInitialStateService $initialStateService,
$userId) {
$this->appName = $appName;
$this->urlGenerator = $urlGenerator;
$this->request = $request;
$this->l = $l;
public function __construct(IConfig $config,
IInitialState $initialStateService) {
$this->config = $config;
$this->initialStateService = $initialStateService;
$this->userId = $userId;
}
/**
@ -45,7 +34,7 @@ class Admin implements ISettings {
$adminConfig = [
'search_disabled' => $searchDisabled,
];
$this->initialStateService->provideInitialState($this->appName, 'admin-config', $adminConfig);
$this->initialStateService->provideInitialState('admin-config', $adminConfig);
return new TemplateResponse(Application::APP_ID, 'adminSettings');
}

View file

@ -13,13 +13,10 @@ class AdminSection implements IIconSection {
/** @var IURLGenerator */
private $urlGenerator;
public function __construct(string $appName,
IURLGenerator $urlGenerator,
IL10N $l
) {
$this->appName = $appName;
$this->l = $l;
public function __construct(IURLGenerator $urlGenerator,
IL10N $l) {
$this->urlGenerator = $urlGenerator;
$this->l = $l;
}
/**
@ -57,4 +54,4 @@ class AdminSection implements IIconSection {
return $this->urlGenerator->imagePath('core', 'categories/integration.svg');
}
}
}

View file

@ -2,51 +2,45 @@
namespace OCA\Moodle\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCP\IL10N;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\Settings\ISettings;
use OCP\Util;
use OCP\IURLGenerator;
use OCP\IInitialStateService;
use OCA\Moodle\AppInfo\Application;
class Personal implements ISettings {
private $request;
private $config;
private $dataDirPath;
private $urlGenerator;
private $l;
/**
* @var IConfig
*/
private $config;
/**
* @var IInitialState
*/
private $initialStateService;
/**
* @var string|null
*/
private $userId;
public function __construct(
string $appName,
IL10N $l,
IRequest $request,
IConfig $config,
IURLGenerator $urlGenerator,
IInitialStateService $initialStateService,
$userId) {
$this->appName = $appName;
$this->urlGenerator = $urlGenerator;
$this->request = $request;
$this->l = $l;
$this->config = $config;
$this->initialStateService = $initialStateService;
$this->userId = $userId;
}
public function __construct(IConfig $config,
IInitialState $initialStateService,
?string $userId) {
$this->config = $config;
$this->initialStateService = $initialStateService;
$this->userId = $userId;
}
/**
* @return TemplateResponse
*/
public function getForm(): TemplateResponse {
$token = $this->config->getUserValue($this->userId, Application::APP_ID, 'token', '');
$url = $this->config->getUserValue($this->userId, Application::APP_ID, 'url', '');
$token = $this->config->getUserValue($this->userId, Application::APP_ID, 'token');
$url = $this->config->getUserValue($this->userId, Application::APP_ID, 'url');
$searchCoursesEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'search_courses_enabled', '0');
$searchModulesEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'search_modules_enabled', '0');
$searchUpcomingEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'search_upcoming_enabled', '0');
$userName = $this->config->getUserValue($this->userId, Application::APP_ID, 'user_name', '');
$userName = $this->config->getUserValue($this->userId, Application::APP_ID, 'user_name');
$checkSsl = $this->config->getUserValue($this->userId, Application::APP_ID, 'check_ssl', '1') === '1';
$searchDisabled = $this->config->getAppValue(Application::APP_ID, 'search_disabled', '0') === '1';
@ -61,7 +55,7 @@ class Personal implements ISettings {
'check_ssl' => $checkSsl,
'search_disabled' => $searchDisabled,
];
$this->initialStateService->provideInitialState($this->appName, 'user-config', $userConfig);
$this->initialStateService->provideInitialState('user-config', $userConfig);
return new TemplateResponse(Application::APP_ID, 'personalSettings');
}

View file

@ -7,54 +7,50 @@ use OCP\Settings\IIconSection;
class PersonalSection implements IIconSection {
/** @var IL10N */
private $l;
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $urlGenerator;
/** @var IURLGenerator */
private $urlGenerator;
public function __construct(string $appName,
IURLGenerator $urlGenerator,
IL10N $l
) {
$this->appName = $appName;
$this->l = $l;
$this->urlGenerator = $urlGenerator;
}
public function __construct(IURLGenerator $urlGenerator,
IL10N $l) {
$this->l = $l;
$this->urlGenerator = $urlGenerator;
}
/**
* returns the ID of the section. It is supposed to be a lower case string
*
* @returns string
*/
public function getID(): string {
return 'connected-accounts'; //or a generic id if feasible
}
/**
* returns the ID of the section. It is supposed to be a lower case string
*
* @returns string
*/
public function getID(): string {
return 'connected-accounts'; //or a generic id if feasible
}
/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName(): string {
return $this->l->t('Connected accounts');
}
/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName(): string {
return $this->l->t('Connected accounts');
}
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*/
public function getPriority(): int {
return 80;
}
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*/
public function getPriority(): int {
return 80;
}
/**
* @return ?string The relative path to a an icon describing the section
*/
public function getIcon(): ?string {
return $this->urlGenerator->imagePath('core', 'categories/integration.svg');
}
}
/**
* @return ?string The relative path to a an icon describing the section
*/
public function getIcon(): ?string {
return $this->urlGenerator->imagePath('core', 'categories/integration.svg');
}
}