Skip to content

Commit 973193d

Browse files
committed
fix(codestyle): Run cs:fix
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent d362542 commit 973193d

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

lib/Classifiers/Classifier.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,20 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
102102
$path = $this->getConvertedFilePath($files[0]);
103103
if (in_array($model, [ImagenetClassifier::MODEL_NAME, LandmarksClassifier::MODEL_NAME, ClusteringFaceClassifier::MODEL_NAME], true)) {
104104
// Check file data size
105-
$filesize = filesize($path);
106-
if ($filesize !== false) {
107-
$filesizeMb = $filesize / (1024 * 1024);
108-
if ($filesizeMb > 8) {
109-
$this->logger->debug('File is too large for classifier: ' . $files[0]->getPath());
110-
try {
111-
$this->logger->debug('removing ' . $queueFile->getFileId() . ' from ' . $model . ' queue');
112-
$this->queue->removeFromQueue($model, $queueFile);
113-
} catch (Exception $e) {
114-
$this->logger->warning($e->getMessage(), ['exception' => $e]);
115-
}
116-
continue;
117-
}
118-
}
105+
$filesize = filesize($path);
106+
if ($filesize !== false) {
107+
$filesizeMb = $filesize / (1024 * 1024);
108+
if ($filesizeMb > 8) {
109+
$this->logger->debug('File is too large for classifier: ' . $files[0]->getPath());
110+
try {
111+
$this->logger->debug('removing ' . $queueFile->getFileId() . ' from ' . $model . ' queue');
112+
$this->queue->removeFromQueue($model, $queueFile);
113+
} catch (Exception $e) {
114+
$this->logger->warning($e->getMessage(), ['exception' => $e]);
115+
}
116+
continue;
117+
}
118+
}
119119
// Check file dimensions
120120
$dimensions = @getimagesize($path);
121121
if (isset($dimensions) && $dimensions !== false && ($dimensions[0] > 1024 || $dimensions[1] > 1024)) {
@@ -348,13 +348,13 @@ public function generatePreviewWithProvider(File $file): string {
348348

349349
if (in_array($imagetype, [IMAGETYPE_WEBP, IMAGETYPE_AVIF, false])) { // To troubleshoot if it is a webp or avif.
350350
$imageString = file_get_contents($tmpname);
351-
if ($imageString === false) {
352-
throw new \OCA\Recognize\Exception\Exception('Could not load preview file from temp folder');
353-
}
354-
$previewImage = imagecreatefromstring($imageString);
355-
if ($previewImage === false) {
356-
throw new \OCA\Recognize\Exception\Exception('Could not load preview file from temp folder');
357-
}
351+
if ($imageString === false) {
352+
throw new \OCA\Recognize\Exception\Exception('Could not load preview file from temp folder');
353+
}
354+
$previewImage = imagecreatefromstring($imageString);
355+
if ($previewImage === false) {
356+
throw new \OCA\Recognize\Exception\Exception('Could not load preview file from temp folder');
357+
}
358358
$use_gd_quality = (int)\OCP\Server::get(IConfig::class)->getSystemValue('recognize.preview.quality', '100');
359359
if (imagejpeg($previewImage, $tmpname, $use_gd_quality) === false) {
360360
imagedestroy($previewImage);
@@ -372,20 +372,20 @@ public function generatePreviewWithProvider(File $file): string {
372372
* @throws \OCA\Recognize\Exception\Exception
373373
*/
374374
public function generatePreviewWithGD(string $path): string {
375-
$imageContents = file_get_contents($path);
376-
if (!$imageContents) {
377-
throw new \OCA\Recognize\Exception\Exception('Could not load image for preview with gdlib');
378-
}
375+
$imageContents = file_get_contents($path);
376+
if (!$imageContents) {
377+
throw new \OCA\Recognize\Exception\Exception('Could not load image for preview with gdlib');
378+
}
379379
$image = imagecreatefromstring($imageContents);
380380
if (!$image) {
381381
throw new \OCA\Recognize\Exception\Exception('Could not load image for preview with gdlib');
382382
}
383383
$width = imagesx($image);
384384
$height = imagesy($image);
385385

386-
if ($width === false || $height === false) {
387-
throw new \OCA\Recognize\Exception\Exception('Could not get image dimensions for preview with gdlib');
388-
}
386+
if ($width === false || $height === false) {
387+
throw new \OCA\Recognize\Exception\Exception('Could not get image dimensions for preview with gdlib');
388+
}
389389

390390
$maxWidth = (float) self::TEMP_FILE_DIMENSION;
391391
$maxHeight = (float) self::TEMP_FILE_DIMENSION;

lib/Clustering/DualTreeClique.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public function propagateSetChanges(array &$labelToSetId) {
6363
}
6464

6565
$labels = $this->dataset->labels();
66-
$lastLabel = array_pop($labels);
67-
if (!isset($labelToSetId[$lastLabel])) {
68-
return null;
69-
}
66+
$lastLabel = array_pop($labels);
67+
if (!isset($labelToSetId[$lastLabel])) {
68+
return null;
69+
}
7070
$setId = $labelToSetId[$lastLabel];
7171

7272
foreach ($labels as $label) {

lib/Clustering/MrdBallTree.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
final class MrdBallTree extends BallTree {
1717
private ?Labeled $dataset = null;
1818
private array $nativeInterpointCache = [];
19-
/**
20-
* @var array<array-key,list<float>>
21-
*/
19+
/**
20+
* @var array<array-key,list<float>>
21+
*/
2222
private array $coreDistances = [];
23-
/**
24-
* @var array<array-key,list<float>>
25-
*/
23+
/**
24+
* @var array<array-key,list<float>>
25+
*/
2626
private array $coreNeighborDistances = [];
2727
private int $sampleSize;
2828
private array $nodeDistances;
@@ -179,7 +179,7 @@ private function updateNearestNeighbors($queryNode, $referenceNode, $k, $maxRang
179179
}
180180

181181
if ($this->kernel instanceof SquaredDistance) {
182-
$longestDistance = (float) min($longestDistance, (2.0* sqrt($queryNode->radius()) + sqrt($shortestDistance)) ** 2.0);
182+
$longestDistance = (float) min($longestDistance, (2.0 * sqrt($queryNode->radius()) + sqrt($shortestDistance)) ** 2.0);
183183
} else {
184184
$longestDistance = (float) min($longestDistance, 2.0 * $queryNode->radius() + $shortestDistance);
185185
}

lib/Clustering/MstClusterer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ public function processCluster(): array {
115115
}
116116

117117
$currentLongestEdgeKey = array_key_last($this->remainingEdges);
118-
/**
119-
* @var $currentLongestEdge array{vertexFrom: int, vertexTo:int, distance:float, finalLambda?: float}
120-
*/
121-
$currentLongestEdge = array_pop($this->remainingEdges);
118+
/**
119+
* @var $currentLongestEdge array{vertexFrom: int, vertexTo:int, distance:float, finalLambda?: float}
120+
*/
121+
$currentLongestEdge = array_pop($this->remainingEdges);
122122

123123
$vertexConnectedFrom = $currentLongestEdge["vertexFrom"];
124124
$vertexConnectedTo = $currentLongestEdge["vertexTo"];

0 commit comments

Comments
 (0)