Skip to content

Commit 9bb9661

Browse files
committed
Apply cs fixes
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent a546de0 commit 9bb9661

48 files changed

Lines changed: 227 additions & 301 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/AppConfig.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use \OCP\IConfig;
1616

1717
class AppConfig {
18-
1918
public const FEDERATION_USE_TRUSTED_DOMAINS = 'federation_use_trusted_domains';
2019

2120
public const SYSTEM_GS_TRUSTED_HOSTS = 'gs.trustedHosts';
@@ -30,13 +29,13 @@ class AppConfig {
3029
'token_ttl' => 36000, // 10 hours
3130
];
3231

33-
const WATERMARK_APP_NAMESPACE = 'files';
32+
public const WATERMARK_APP_NAMESPACE = 'files';
3433

35-
const APP_SETTING_TYPES = [
36-
'watermark_allGroupsList' => 'array',
37-
'watermark_allTagsList' => 'array',
38-
'watermark_linkTagsList' => 'array'
39-
];
34+
public const APP_SETTING_TYPES = [
35+
'watermark_allGroupsList' => 'array',
36+
'watermark_allTagsList' => 'array',
37+
'watermark_linkTagsList' => 'array'
38+
];
4039

4140
/** @var IConfig */
4241
private $config;
@@ -59,7 +58,7 @@ public function getAppNamespace($key) {
5958
*/
6059
public function getAppValue($key) {
6160
$defaultValue = null;
62-
if (array_key_exists($key, $this->defaults)){
61+
if (array_key_exists($key, $this->defaults)) {
6362
$defaultValue = $this->defaults[$key];
6463
}
6564
return $this->config->getAppValue($this->getAppNamespace($key), $key, $defaultValue);
@@ -124,5 +123,4 @@ public function getTrustedDomains(): array {
124123
public function isTrustedDomainAllowedForFederation(): bool {
125124
return $this->config->getAppValue(Application::APPNAME, self::FEDERATION_USE_TRUSTED_DOMAINS, 'no') === 'yes';
126125
}
127-
128-
}
126+
}

lib/AppInfo/Application.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
namespace OCA\Richdocuments\AppInfo;
2626

2727
use OC\EventDispatcher\SymfonyAdapter;
28-
use OC\Files\Type\Detection;
2928
use OC\Security\CSP\ContentSecurityPolicy;
30-
use OCA\Files_Sharing\Listener\LoadAdditionalListener;
3129
use OCA\Richdocuments\AppConfig;
3230
use OCA\Richdocuments\Capabilities;
3331
use OCA\Richdocuments\Middleware\WOPIMiddleware;
@@ -57,7 +55,6 @@
5755
use OCP\IPreview;
5856

5957
class Application extends App implements IBootstrap {
60-
6158
public const APPNAME = 'richdocuments';
6259

6360
public function __construct(array $urlParams = array()) {
@@ -75,15 +72,15 @@ public function register(IRegistrationContext $context): void {
7572

7673
public function boot(IBootContext $context): void {
7774
$currentUser = \OC::$server->getUserSession()->getUser();
78-
if($currentUser !== null) {
75+
if ($currentUser !== null) {
7976
/** @var PermissionManager $permissionManager */
8077
$permissionManager = \OC::$server->query(PermissionManager::class);
81-
if(!$permissionManager->isEnabledForUser($currentUser)) {
78+
if (!$permissionManager->isEnabledForUser($currentUser)) {
8279
return;
8380
}
8481
}
8582

86-
$context->injectFn(function(ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService) {
83+
$context->injectFn(function (ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService) {
8784
if (empty($capabilitiesService->getCapabilities())) {
8885
return;
8986
}
@@ -98,7 +95,7 @@ public function boot(IBootContext $context): void {
9895
$odtType->addMimetype('application/vnd.oasis.opendocument.text-template');
9996
}
10097
$odtType->setIconClass('icon-filetype-document');
101-
$odtType->setRatio(21/29.7);
98+
$odtType->setRatio(21 / 29.7);
10299
return $odtType;
103100
});
104101
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) {
@@ -111,7 +108,7 @@ public function boot(IBootContext $context): void {
111108
$odsType->addMimetype('application/vnd.oasis.opendocument.spreadsheet-template');
112109
}
113110
$odsType->setIconClass('icon-filetype-spreadsheet');
114-
$odsType->setRatio(16/9);
111+
$odsType->setRatio(16 / 9);
115112
return $odsType;
116113
});
117114
$templateManager->registerTemplateFileCreator(function () use ($l10n, $ooxml) {
@@ -124,7 +121,7 @@ public function boot(IBootContext $context): void {
124121
$odpType->addMimetype('application/vnd.oasis.opendocument.presentation-template');
125122
}
126123
$odpType->setIconClass('icon-filetype-presentation');
127-
$odpType->setRatio(16/9);
124+
$odpType->setRatio(16 / 9);
128125
return $odpType;
129126
});
130127

@@ -174,23 +171,23 @@ public function registerProvider() {
174171
/** @var IPreview $previewManager */
175172
$previewManager = $container->query(IPreview::class);
176173

177-
$previewManager->registerProvider('/application\/vnd.ms-excel/', function() use ($container) {
174+
$previewManager->registerProvider('/application\/vnd.ms-excel/', function () use ($container) {
178175
return $container->query(MSExcel::class);
179176
});
180177

181-
$previewManager->registerProvider('/application\/msword/', function() use ($container) {
178+
$previewManager->registerProvider('/application\/msword/', function () use ($container) {
182179
return $container->query(MSWord::class);
183180
});
184181

185-
$previewManager->registerProvider('/application\/vnd.openxmlformats-officedocument.*/', function() use ($container) {
182+
$previewManager->registerProvider('/application\/vnd.openxmlformats-officedocument.*/', function () use ($container) {
186183
return $container->query(OOXML::class);
187184
});
188185

189-
$previewManager->registerProvider('/application\/vnd.oasis.opendocument.*/', function() use ($container) {
186+
$previewManager->registerProvider('/application\/vnd.oasis.opendocument.*/', function () use ($container) {
190187
return $container->query(OpenDocument::class);
191188
});
192189

193-
$previewManager->registerProvider('/application\/pdf/', function() use ($container) {
190+
$previewManager->registerProvider('/application\/pdf/', function () use ($container) {
194191
return $container->query(Pdf::class);
195192
});
196193
}
@@ -261,8 +258,9 @@ public function checkAndEnableCODEServer() {
261258
// Supported only on Linux OS, and x86_64 & ARM64 platforms
262259
$supportedArchs = array('x86_64', 'aarch64');
263260
$osFamily = PHP_VERSION_ID >= 70200 ? PHP_OS_FAMILY : PHP_OS;
264-
if ($osFamily !== 'Linux' || !in_array(php_uname('m'), $supportedArchs))
261+
if ($osFamily !== 'Linux' || !in_array(php_uname('m'), $supportedArchs)) {
265262
return;
263+
}
266264

267265
$CODEAppID = (php_uname('m') === 'x86_64') ? 'richdocumentscode' : 'richdocumentscode_arm64';
268266

@@ -307,8 +305,8 @@ public function checkAndEnableCODEServer() {
307305
private function domainOnly($url) {
308306
$parsed_url = parse_url($url);
309307
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
310-
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
311-
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
308+
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
309+
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
312310
return "$scheme$host$port";
313311
}
314312
}

lib/Backgroundjobs/Cleanup.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(IDBConnection $db, WopiMapper $wopiMapper) {
3939
$this->db = $db;
4040
$this->wopiMapper = $wopiMapper;
4141

42-
$this->setInterval(60*60);
42+
$this->setInterval(60 * 60);
4343
}
4444

4545
protected function run($argument) {
@@ -51,11 +51,9 @@ protected function run($argument) {
5151

5252
// Expired WOPI access tokens
5353
$this->cleanUpWopiTokens();
54-
5554
}
5655

57-
private function cleanUpWopiTokens()
58-
{
56+
private function cleanUpWopiTokens() {
5957
$tokenIds = $this->wopiMapper->getExpiredTokenIds(1000);
6058
$query = $this->db->getQueryBuilder();
6159
$query->delete('richdocuments_wopi')

lib/Backgroundjobs/ObtainCapabilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ObtainCapabilities extends TimedJob {
3434
public function __construct(CapabilitiesService $capabilitiesService) {
3535
$this->capabilitiesService = $capabilitiesService;
3636

37-
$this->setInterval(60*60);
37+
$this->setInterval(60 * 60);
3838
}
3939

4040
protected function run($argument) {

lib/Capabilities.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
use OCP\IL10N;
2929

3030
class Capabilities implements ICapability {
31-
32-
const MIMETYPES = [
31+
public const MIMETYPES = [
3332
'application/vnd.oasis.opendocument.text',
3433
'application/vnd.oasis.opendocument.spreadsheet',
3534
'application/vnd.oasis.opendocument.graphics',
@@ -68,7 +67,7 @@ class Capabilities implements ICapability {
6867
'text/csv'
6968
];
7069

71-
const MIMETYPES_OPTIONAL = [
70+
public const MIMETYPES_OPTIONAL = [
7271
'image/svg+xml',
7372
'application/pdf',
7473
'text/plain',

lib/Command/ActivateConfig.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@
2626

2727
use OCA\Richdocuments\AppConfig;
2828
use OCA\Richdocuments\Service\CapabilitiesService;
29-
use OCA\Richdocuments\TemplateManager;
3029
use OCA\Richdocuments\WOPI\DiscoveryManager;
3130
use OCA\Richdocuments\WOPI\Parser;
3231
use Symfony\Component\Console\Command\Command;
33-
use Symfony\Component\Console\Input\InputArgument;
3432
use Symfony\Component\Console\Input\InputInterface;
3533
use Symfony\Component\Console\Output\OutputInterface;
3634

@@ -85,5 +83,4 @@ protected function execute(InputInterface $input, OutputInterface $output) {
8583
return 1;
8684
}
8785
}
88-
8986
}

lib/Command/UpdateEmptyTemplates.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
use OCA\Richdocuments\TemplateManager;
2828
use Symfony\Component\Console\Command\Command;
29-
use Symfony\Component\Console\Input\InputArgument;
3029
use Symfony\Component\Console\Input\InputInterface;
3130
use Symfony\Component\Console\Output\OutputInterface;
3231

@@ -58,5 +57,4 @@ protected function execute(InputInterface $input, OutputInterface $output) {
5857
return 1;
5958
}
6059
}
61-
6260
}

lib/Controller/DirectViewController.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ public function show($token) {
140140
}
141141

142142
$relativePath = '/new.odt';
143-
144143
} else {
145144
try {
146145
$item = $folder->getById($direct->getFileid())[0];
147-
if(!($item instanceof Node)) {
146+
if (!($item instanceof Node)) {
148147
throw new \Exception();
149148
}
150149

@@ -190,7 +189,6 @@ public function show($token) {
190189
$this->logger->logException($e);
191190
return $this->renderErrorPage('Failed to open the requested file.');
192191
}
193-
194192
}
195193

196194
public function showPublicShare(Direct $direct) {
@@ -245,12 +243,11 @@ public function showPublicShare(Direct $direct) {
245243
return $response;
246244
}
247245
} catch (\Exception $e) {
248-
$this->logger->logException($e, ['app'=>'richdocuments']);
246+
$this->logger->logException($e, ['app' => 'richdocuments']);
249247
return $this->renderErrorPage('Failed to open the requested file.');
250248
}
251249

252250
return new TemplateResponse('core', '403', [], 'guest');
253-
254251
}
255252

256253
private function renderErrorPage($message) {

lib/Controller/DocumentAPIController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
use Throwable;
4141

4242
class DocumentAPIController extends \OCP\AppFramework\OCSController {
43-
4443
private $rootFolder;
4544
private $shareManager;
4645
private $templateManager;

0 commit comments

Comments
 (0)