Skip to content

Commit 377826a

Browse files
committed
Apply php-cs-fixer changes
1 parent 7f66528 commit 377826a

24 files changed

+100
-100
lines changed

lib/BackgroundJobs/ProcessFileJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ProcessFileJob extends \OCP\BackgroundJob\QueuedJob {
3939
protected $logger;
4040
/** @var IOcrService */
4141
private $ocrService;
42-
42+
4343
public function __construct(
4444
LoggerInterface $logger,
4545
IOcrService $ocrService,
@@ -48,7 +48,7 @@ public function __construct(
4848
$this->logger = $logger;
4949
$this->ocrService = $ocrService;
5050
}
51-
51+
5252
/**
5353
* @param mixed $argument
5454
*/

lib/Events/TextRecognizedEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TextRecognizedEvent extends Event {
4444
*/
4545
public function __construct(string $recognizedText, File $file) {
4646
parent::__construct();
47-
47+
4848
$this->recognizedText = $recognizedText;
4949
$this->file = $file;
5050
}

lib/Notification/Notifier.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public function prepare(INotification $notification, string $languageCode): INot
104104

105105
// Only add file info if we have some ...
106106
$richParams = false;
107-
if ($notification->getObjectType() === 'file' &&
108-
($fileId = $notification->getObjectId()) &&
109-
($uid = $notification->getUser())) {
107+
if ($notification->getObjectType() === 'file'
108+
&& ($fileId = $notification->getObjectId())
109+
&& ($uid = $notification->getUser())) {
110110
$richParams = $this->tryGetRichParamForFile($uid, intval($fileId));
111111
if ($richParams !== false) {
112112
$notification->setRichSubject($richSubject, $richParams);
113113
}
114114
}
115-
115+
116116
// Fallback to generic error message without file link
117117
if ($richParams === false) {
118118
$notification->setParsedSubject($parsedSubject);

lib/OcrProcessors/CommandLineUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444

4545
public function getCommandlineArgs(WorkflowSettings $settings, GlobalSettings $globalSettings, ?string $sidecarFile = null, array $additionalCommandlineArgs = []): string {
4646
$isLocalExecution = !$this->ocrBackendInfoService->isRemoteBackend();
47-
47+
4848
// Default setting is quiet
4949
$args = $isLocalExecution ? ['-q'] : [];
5050

lib/OcrProcessors/OcrProcessorFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ public static function registerOcrProcessors(IRegistrationContext $context) : vo
6767
* "singleton per request" which leads to problems regarding the reused Command object
6868
* under the hood.
6969
*/
70-
$context->registerService(PdfOcrProcessor::class, fn (ContainerInterface $c) =>
71-
new PdfOcrProcessor(
70+
$context->registerService(PdfOcrProcessor::class, fn (ContainerInterface $c)
71+
=> new PdfOcrProcessor(
7272
$c->get(ICommand::class),
7373
$c->get(LoggerInterface::class),
7474
$c->get(ISidecarFileAccessor::class),
7575
$c->get(ICommandLineUtils::class)), false);
76-
$context->registerService(ImageOcrProcessor::class, fn (ContainerInterface $c) =>
77-
new ImageOcrProcessor(
76+
$context->registerService(ImageOcrProcessor::class, fn (ContainerInterface $c)
77+
=> new ImageOcrProcessor(
7878
$c->get(ICommand::class),
7979
$c->get(LoggerInterface::class),
8080
$c->get(ISidecarFileAccessor::class),

lib/OcrProcessors/Remote/Client/ApiClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(
3737
private LoggerInterface $logger,
3838
) {
3939
}
40-
40+
4141
public function processOcr($file, string $fileName, string $ocrMyPdfParameters): OcrResult|ErrorResult {
4242
$options = [
4343
'multipart' => [
@@ -92,7 +92,7 @@ private function exAppRequest(string $path, ?array $options, string $method, boo
9292
$options ?? []
9393
);
9494
$this->logger->debug('Response received', ['path' => $path, 'response' => $response]);
95-
95+
9696
if (is_array($response) || ($throwIfResponseCodeNot200 && $response->getStatusCode() !== 200)) {
9797
$this->logger->error('Request failed', ['path' => $path, 'response' => $response]);
9898
throw new RuntimeException('Request failed');

lib/OcrProcessors/Remote/WorkflowOcrRemoteProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public function __construct(
4646
) {
4747

4848
}
49-
49+
5050
public function ocrFile(File $file, WorkflowSettings $settings, GlobalSettings $globalSettings): OcrProcessorResult {
5151
$ocrMyPdfParameters = $this->commandLineUtils->getCommandlineArgs($settings, $globalSettings);
5252
$fileResource = $file->fopen('rb');
5353
$fileName = $file->getName();
54-
54+
5555
$this->logger->debug('Sending OCR request to remote backend');
5656
$apiResult = $this->apiClient->processOcr($fileResource, $fileName, $ocrMyPdfParameters);
5757
$this->logger->debug('OCR result received', ['apiResult' => $apiResult]);

lib/Operation.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch
104104
$this->logger->debug('onEvent: ' . $eventName);
105105

106106
// $node and $argsArray will be passed by reference
107-
if (!($match = $this->getMatch($ruleMatcher)) ||
108-
!$this->tryGetFile($eventName, $event, $node) ||
109-
$this->eventTriggeredByOcrProcess($node) ||
110-
!$this->tryGetJobArgs($node, $match['operation'], $argsArray)) {
107+
if (!($match = $this->getMatch($ruleMatcher))
108+
|| !$this->tryGetFile($eventName, $event, $node)
109+
|| $this->eventTriggeredByOcrProcess($node)
110+
|| !$this->tryGetJobArgs($node, $match['operation'], $argsArray)) {
111111
return;
112112
}
113-
113+
114114
$this->logger->debug('Adding file to jobqueue: ' . json_encode($argsArray));
115-
115+
116116
$this->jobList->add(ProcessFileJob::class, $argsArray);
117117
}
118118

@@ -140,7 +140,7 @@ private function tryGetFile(string $eventName, Event $event, ?Node & $node) : bo
140140

141141
private function tryGetFileFromGenericEvent(string $eventName, GenericEvent $event, ?Node & $node) : bool {
142142
$node = $event->getSubject();
143-
143+
144144
// Some events have two nodes involved
145145
$arrayEvents = [
146146
'\OCP\Files::postRename',

lib/Service/OcrService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function runOcrProcess(int $fileId, string $uid, WorkflowSettings $settin
155155

156156
$ocrProcessor = $this->ocrProcessorFactory->create($file->getMimeType());
157157
$globalSettings = $this->globalSettingsService->getGlobalSettings();
158-
158+
159159
try {
160160
$result = $ocrProcessor->ocrFile($file, $settings, $globalSettings);
161161
} catch (OcrAlreadyDoneException $ex) {
@@ -181,9 +181,9 @@ private function parseArguments($argument) : array {
181181
throw new \InvalidArgumentException('Argument is not an array in ' . self::class . ' method \'tryParseArguments\'.');
182182
}
183183

184-
$getArgument = fn ($key) => array_key_exists($key, $argument) ?
185-
$argument[$key] :
186-
throw new \InvalidArgumentException("Argument key '$key' not found in " . self::class . ' method \'tryParseArguments\'.');
184+
$getArgument = fn ($key) => array_key_exists($key, $argument)
185+
? $argument[$key]
186+
: throw new \InvalidArgumentException("Argument key '$key' not found in " . self::class . ' method \'tryParseArguments\'.');
187187

188188
$jsonSettings = $getArgument('settings');
189189
$settings = new WorkflowSettings($jsonSettings);
@@ -222,7 +222,7 @@ private function getNode(int $fileId) : Node {
222222
if (count($nodeArr) === 0) {
223223
throw new NotFoundException('Could not process file with id \'' . $fileId . '\'. File was not found');
224224
}
225-
225+
226226
$node = array_shift($nodeArr);
227227

228228
if (!$node instanceof Node || $node->getType() !== FileInfo::TYPE_FILE) {
@@ -263,7 +263,7 @@ private function processTagsAfterSuccessfulOcr(File $file, WorkflowSettings $set
263263
private function createNewFileVersion(string $filePath, string $ocrContent, ?int $fileMtime = null) : void {
264264
$dirPath = dirname($filePath);
265265
$filename = basename($filePath);
266-
266+
267267
$this->processingFileAccessor->setCurrentlyProcessedFilePath($filePath);
268268

269269
try {

lib/Settings/GlobalSettings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class GlobalSettings implements ISettings {
3737
public function getForm() : TemplateResponse {
3838
return new TemplateResponse(Application::APP_NAME, 'globalSettings', [], 'blank');
3939
}
40-
40+
4141
public function getSection(): string {
4242
return 'workflow';
4343
}
44-
44+
4545
public function getPriority(): int {
4646
return 75;
4747
}

0 commit comments

Comments
 (0)