Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/external.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-07-20 12:26:57 +0300
committerJoas Schilling <coding@schilljs.com>2022-07-20 12:26:57 +0300
commit931ae818475a784e13f4728234c709d350f425c3 (patch)
tree9d92a10b0af63866de044fa4748c9493e3ce239c
parent7fb635a6416e0dad1789960e75a0426a63ed1e1b (diff)
Adjust coding styleci
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/AppInfo/Application.php7
-rw-r--r--lib/BeforeTemplateRenderedListener.php12
-rw-r--r--lib/Controller/APIController.php3
-rw-r--r--lib/Controller/IconController.php8
-rw-r--r--lib/Controller/SiteController.php12
-rw-r--r--lib/Exceptions/GroupNotFoundException.php3
-rw-r--r--lib/Exceptions/IconNotFoundException.php3
-rw-r--r--lib/Exceptions/InvalidDeviceException.php3
-rw-r--r--lib/Exceptions/InvalidNameException.php3
-rw-r--r--lib/Exceptions/InvalidTypeException.php3
-rw-r--r--lib/Exceptions/InvalidURLException.php3
-rw-r--r--lib/Exceptions/LanguageNotFoundException.php3
-rw-r--r--lib/Exceptions/SiteNotFoundException.php3
-rw-r--r--lib/Migration/CopyDefaultIcons.php1
-rw-r--r--lib/Settings/Personal.php6
-rw-r--r--lib/SitesManager.php63
16 files changed, 70 insertions, 66 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 8bac0c6..afd1309 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -38,7 +38,6 @@ use OCP\IURLGenerator;
use OCP\Settings\IManager;
class Application extends App implements IBootstrap {
-
public const APP_ID = 'external';
public function __construct() {
@@ -74,7 +73,7 @@ class Application extends App implements IBootstrap {
continue;
}
- $navigationManager->add(function() use ($site, $url) {
+ $navigationManager->add(function () use ($site, $url) {
if ($site['icon'] !== '') {
$image = $url->linkToRoute('external.icon.showIcon', ['icon' => $site['icon']]);
} else {
@@ -83,12 +82,12 @@ class Application extends App implements IBootstrap {
$href = $site['url'];
if (!$site['redirect']) {
- $href = $url->linkToRoute('external.site.showPage', ['id'=> $site['id']]);
+ $href = $url->linkToRoute('external.site.showPage', ['id' => $site['id']]);
}
return [
'id' => 'external_index' . $site['id'],
- 'order' => 80 + $site['id'],
+ 'order' => 80 + $site['id'],
'href' => $href,
'icon' => $image,
'type' => $site['type'],
diff --git a/lib/BeforeTemplateRenderedListener.php b/lib/BeforeTemplateRenderedListener.php
index 16c91a9..9b17223 100644
--- a/lib/BeforeTemplateRenderedListener.php
+++ b/lib/BeforeTemplateRenderedListener.php
@@ -41,8 +41,8 @@ class BeforeTemplateRenderedListener implements IEventListener {
protected $urlGenerator;
public function __construct(SitesManager $sitesManager,
- INavigationManager $navigationManager,
- IURLGenerator $urlGenerator) {
+ INavigationManager $navigationManager,
+ IURLGenerator $urlGenerator) {
$this->sitesManager = $sitesManager;
$this->navigationManager = $navigationManager;
$this->urlGenerator = $urlGenerator;
@@ -65,7 +65,7 @@ class BeforeTemplateRenderedListener implements IEventListener {
if ($site['type'] === SitesManager::TYPE_QUOTA) {
$link = $site['url'];
if (!$site['redirect']) {
- $link = $this->urlGenerator->linkToRoute('external.site.showPage', ['id'=> $site['id']]);
+ $link = $this->urlGenerator->linkToRoute('external.site.showPage', ['id' => $site['id']]);
}
$event->addHiddenField('external_quota_link', $link);
@@ -81,11 +81,11 @@ class BeforeTemplateRenderedListener implements IEventListener {
$sites = $this->sitesManager->getSitesToDisplay();
foreach ($sites as $id => $site) {
- if ($site['type'] !== SitesManager::TYPE_LINK && $site['type'] !== SitesManager::TYPE_SETTING && $site['type'] !== SitesManager::TYPE_LOGIN ) {
+ if ($site['type'] !== SitesManager::TYPE_LINK && $site['type'] !== SitesManager::TYPE_SETTING && $site['type'] !== SitesManager::TYPE_LOGIN) {
continue;
}
- $this->navigationManager->add(function() use ($site) {
+ $this->navigationManager->add(function () use ($site) {
if ($site['icon'] !== '') {
$image = $this->urlGenerator->linkToRoute('external.icon.showIcon', ['icon' => $site['icon']]);
} else {
@@ -94,7 +94,7 @@ class BeforeTemplateRenderedListener implements IEventListener {
$href = $site['url'];
if (!$site['redirect']) {
- $href = $this->urlGenerator->linkToRoute('external.site.showPage', ['id'=> $site['id']]);
+ $href = $this->urlGenerator->linkToRoute('external.site.showPage', ['id' => $site['id']]);
}
return [
diff --git a/lib/Controller/APIController.php b/lib/Controller/APIController.php
index 194cd3b..0b3ed88 100644
--- a/lib/Controller/APIController.php
+++ b/lib/Controller/APIController.php
@@ -36,7 +36,6 @@ use OCP\AppFramework\OCSController;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserSession;
class APIController extends OCSController {
@@ -107,7 +106,7 @@ class APIController extends OCSController {
* @return DataResponse
*/
public function getAdmin() {
- $icons = array_map(function($icon) {
+ $icons = array_map(function ($icon) {
return [
'icon' => $icon,
'name' => $icon,
diff --git a/lib/Controller/IconController.php b/lib/Controller/IconController.php
index 9ec4963..9e3373d 100644
--- a/lib/Controller/IconController.php
+++ b/lib/Controller/IconController.php
@@ -150,10 +150,10 @@ class IconController extends Controller {
}
if (strpos($icon, '-dark.') === false && $this->request->isUserAgent([
- IRequest::USER_AGENT_CLIENT_ANDROID,
- IRequest::USER_AGENT_CLIENT_IOS,
- IRequest::USER_AGENT_CLIENT_DESKTOP,
- ])) {
+ IRequest::USER_AGENT_CLIENT_ANDROID,
+ IRequest::USER_AGENT_CLIENT_IOS,
+ IRequest::USER_AGENT_CLIENT_DESKTOP,
+ ])) {
// Check if there is a dark icon as well
$basename = pathinfo($iconFile->getName(), PATHINFO_FILENAME);
$basename .= '-dark.';
diff --git a/lib/Controller/SiteController.php b/lib/Controller/SiteController.php
index 8f39ed4..b414d80 100644
--- a/lib/Controller/SiteController.php
+++ b/lib/Controller/SiteController.php
@@ -42,12 +42,12 @@ class SiteController extends Controller {
protected IL10N $l10n;
public function __construct(string $appName,
- IRequest $request,
- IConfig $config,
- INavigationManager $navigationManager,
- SitesManager $sitesManager,
- IURLGenerator $url,
- IL10N $l10n) {
+ IRequest $request,
+ IConfig $config,
+ INavigationManager $navigationManager,
+ SitesManager $sitesManager,
+ IURLGenerator $url,
+ IL10N $l10n) {
parent::__construct($appName, $request);
$this->config = $config;
$this->sitesManager = $sitesManager;
diff --git a/lib/Exceptions/GroupNotFoundException.php b/lib/Exceptions/GroupNotFoundException.php
index e33c879..8721fca 100644
--- a/lib/Exceptions/GroupNotFoundException.php
+++ b/lib/Exceptions/GroupNotFoundException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class GroupNotFoundException extends \OutOfBoundsException {}
+class GroupNotFoundException extends \OutOfBoundsException {
+}
diff --git a/lib/Exceptions/IconNotFoundException.php b/lib/Exceptions/IconNotFoundException.php
index 6e69857..24f8291 100644
--- a/lib/Exceptions/IconNotFoundException.php
+++ b/lib/Exceptions/IconNotFoundException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class IconNotFoundException extends \OutOfBoundsException {}
+class IconNotFoundException extends \OutOfBoundsException {
+}
diff --git a/lib/Exceptions/InvalidDeviceException.php b/lib/Exceptions/InvalidDeviceException.php
index af17f30..29ec6b4 100644
--- a/lib/Exceptions/InvalidDeviceException.php
+++ b/lib/Exceptions/InvalidDeviceException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class InvalidDeviceException extends \UnexpectedValueException {}
+class InvalidDeviceException extends \UnexpectedValueException {
+}
diff --git a/lib/Exceptions/InvalidNameException.php b/lib/Exceptions/InvalidNameException.php
index 44295d9..6001c5c 100644
--- a/lib/Exceptions/InvalidNameException.php
+++ b/lib/Exceptions/InvalidNameException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class InvalidNameException extends \UnexpectedValueException {}
+class InvalidNameException extends \UnexpectedValueException {
+}
diff --git a/lib/Exceptions/InvalidTypeException.php b/lib/Exceptions/InvalidTypeException.php
index 931bd19..8727051 100644
--- a/lib/Exceptions/InvalidTypeException.php
+++ b/lib/Exceptions/InvalidTypeException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class InvalidTypeException extends \UnexpectedValueException {}
+class InvalidTypeException extends \UnexpectedValueException {
+}
diff --git a/lib/Exceptions/InvalidURLException.php b/lib/Exceptions/InvalidURLException.php
index 6f6aba5..ca6e543 100644
--- a/lib/Exceptions/InvalidURLException.php
+++ b/lib/Exceptions/InvalidURLException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class InvalidURLException extends \UnexpectedValueException {}
+class InvalidURLException extends \UnexpectedValueException {
+}
diff --git a/lib/Exceptions/LanguageNotFoundException.php b/lib/Exceptions/LanguageNotFoundException.php
index ec9cdc6..19fa108 100644
--- a/lib/Exceptions/LanguageNotFoundException.php
+++ b/lib/Exceptions/LanguageNotFoundException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class LanguageNotFoundException extends \OutOfBoundsException {}
+class LanguageNotFoundException extends \OutOfBoundsException {
+}
diff --git a/lib/Exceptions/SiteNotFoundException.php b/lib/Exceptions/SiteNotFoundException.php
index 430933c..1c6790e 100644
--- a/lib/Exceptions/SiteNotFoundException.php
+++ b/lib/Exceptions/SiteNotFoundException.php
@@ -21,4 +21,5 @@
namespace OCA\External\Exceptions;
-class SiteNotFoundException extends \OutOfBoundsException {}
+class SiteNotFoundException extends \OutOfBoundsException {
+}
diff --git a/lib/Migration/CopyDefaultIcons.php b/lib/Migration/CopyDefaultIcons.php
index 71e48bd..7ee624c 100644
--- a/lib/Migration/CopyDefaultIcons.php
+++ b/lib/Migration/CopyDefaultIcons.php
@@ -23,7 +23,6 @@
namespace OCA\External\Migration;
-
use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php
index 3ca13ae..852f704 100644
--- a/lib/Settings/Personal.php
+++ b/lib/Settings/Personal.php
@@ -57,12 +57,12 @@ class Personal implements ISettings {
$url = $quotaLink['url'];
if (!$quotaLink['redirect']) {
- $url = $this->url->linkToRoute('external.site.showPage', ['id'=> $quotaLink['id']]);
+ $url = $this->url->linkToRoute('external.site.showPage', ['id' => $quotaLink['id']]);
}
return new TemplateResponse('external', 'quota', [
- 'quotaLink' => $url,
- 'quotaName' => $quotaLink['name'],
+ 'quotaLink' => $url,
+ 'quotaName' => $quotaLink['name'],
], '');
}
diff --git a/lib/SitesManager.php b/lib/SitesManager.php
index e043156..2eb1518 100644
--- a/lib/SitesManager.php
+++ b/lib/SitesManager.php
@@ -41,17 +41,16 @@ use OCP\IUserSession;
use OCP\L10N\IFactory;
class SitesManager {
+ public const TYPE_LINK = 'link';
+ public const TYPE_SETTING = 'settings';
+ public const TYPE_LOGIN = 'guest';
+ public const TYPE_QUOTA = 'quota';
- const TYPE_LINK = 'link';
- const TYPE_SETTING = 'settings';
- const TYPE_LOGIN = 'guest';
- const TYPE_QUOTA = 'quota';
-
- const DEVICE_ALL = '';
- const DEVICE_ANDROID = 'android';
- const DEVICE_IOS = 'ios';
- const DEVICE_DESKTOP = 'desktop';
- const DEVICE_BROWSER = 'browser';
+ public const DEVICE_ALL = '';
+ public const DEVICE_ANDROID = 'android';
+ public const DEVICE_IOS = 'ios';
+ public const DEVICE_DESKTOP = 'desktop';
+ public const DEVICE_BROWSER = 'browser';
/** @var IRequest */
protected $request;
@@ -76,12 +75,12 @@ class SitesManager {
public function __construct(IRequest $request,
- IConfig $config,
- IAppManager $appManager,
- IGroupManager $groupManager,
- IUserSession $userSession,
- IFactory $languageFactory,
- IAppData $appData) {
+ IConfig $config,
+ IAppManager $appManager,
+ IGroupManager $groupManager,
+ IUserSession $userSession,
+ IFactory $languageFactory,
+ IAppData $appData) {
$this->request = $request;
$this->config = $config;
$this->appManager = $appManager;
@@ -122,7 +121,7 @@ class SitesManager {
}
$email = $user instanceof IUser ? $user->getEMailAddress() : '';
- $uid = $user instanceof IUser ? $user->getUID() : '';
+ $uid = $user instanceof IUser ? $user->getUID() : '';
$displayName = $user instanceof IUser ? $user->getDisplayName() : '';
$email = $email ?? '';
@@ -177,13 +176,13 @@ class SitesManager {
*/
protected function fillSiteArray(array $site): array {
return array_merge([
- 'icon' => 'external.svg',
- 'lang' => '',
- 'type' => self::TYPE_LINK,
- 'device' => self::DEVICE_ALL,
- 'groups' => [],
- 'redirect' => false,
- ],
+ 'icon' => 'external.svg',
+ 'lang' => '',
+ 'type' => self::TYPE_LINK,
+ 'device' => self::DEVICE_ALL,
+ 'groups' => [],
+ 'redirect' => false,
+ ],
$site
);
}
@@ -262,9 +261,9 @@ class SitesManager {
$sites = $this->getSites();
$sites[$id] = [
- 'id' => $id,
+ 'id' => $id,
'name' => $name,
- 'url' => $url,
+ 'url' => $url,
'lang' => $lang,
'type' => $type,
'device' => $device,
@@ -356,9 +355,9 @@ class SitesManager {
}
$sites[$id] = [
- 'id' => $id,
+ 'id' => $id,
'name' => $name,
- 'url' => $url,
+ 'url' => $url,
'lang' => $lang,
'type' => $type,
'device' => $device,
@@ -390,9 +389,9 @@ class SitesManager {
foreach ($sites as $id => $site) {
$fixedSites[$id + 1] = $this->fillSiteArray([
- 'id' => $id + 1,
+ 'id' => $id + 1,
'name' => $site[0],
- 'url' => $site[1],
+ 'url' => $site[1],
'icon' => isset($site[2]) ? $site[2] : 'external.svg',
]);
}
@@ -409,7 +408,7 @@ class SitesManager {
try {
$folder = $this->appData->getFolder('icons');
$icons = $folder->getDirectoryListing();
- return array_map(function(ISimpleFile $icon) {
+ return array_map(function (ISimpleFile $icon) {
return $icon->getName();
}, $icons);
} catch (NotFoundException $e) {
@@ -431,7 +430,7 @@ class SitesManager {
$ln = ['code' => $lang, 'name' => $lang];
if ($l->getLanguageCode() === $lang && strpos($potentialName, '_') !== 0) {
$ln = ['code' => $lang, 'name' => $potentialName];
- } else if ($lang === 'en') {
+ } elseif ($lang === 'en') {
$ln = ['code' => $lang, 'name' => 'English (US)'];
}