Skip to content

Commit 2c9b9c7

Browse files
committed
minor tweaks
1 parent 40143c8 commit 2c9b9c7

3 files changed

Lines changed: 9 additions & 30 deletions

File tree

src/Geometry/MinMaxUtils.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public static function getMinMaxY(array $points): MinMax
1919
foreach ($points as $point) {
2020
$yCoords[] = $point->getY();
2121
}
22-
2322
return new MinMax(min($yCoords), max($yCoords));
2423
}
2524

@@ -35,7 +34,6 @@ public static function getMinMaxX(array $points): MinMax
3534
foreach ($points as $point) {
3635
$xCoords[] = $point->getX();
3736
}
38-
3937
return new MinMax(min($xCoords), max($xCoords));
4038
}
4139
}

src/Input/LocalInputSource.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
use CURLFile;
1010
use Exception;
1111
use Mindee\Error\ErrorCode;
12-
use Mindee\Error\MindeeImageException;
1312
use Mindee\Error\MindeeMimeTypeException;
1413
use Mindee\Error\MindeePDFException;
1514
use Mindee\Error\MindeeSourceException;
16-
use Mindee\Error\MindeeUnhandledException;
1715
use Mindee\Image\ImageCompressor;
18-
use Mindee\Parsing\DependencyChecker;
1916
use Mindee\PDF\PDFCompressor;
2017
use Mindee\PDF\PDFUtils;
2118
use setasign\Fpdi\Fpdi;
@@ -131,27 +128,11 @@ public function countDocPages(): int
131128
}
132129
}
133130

134-
/**
135-
* Processes a PDF file.
136-
* To be implemented.
137-
*
138-
* @param string $behavior Behaviors available: KEEP_ONLY, REMOVE.
139-
* @param integer $onMinPages Minimum of pages to apply the operation.
140-
* @param array $pageIndexes Indexes of the pages to apply the operation to.
141-
* @return void
142-
* @throws MindeePDFException Throws if the operation is unknown, or if the resulting PDF can't be processed.
143-
* @deprecated Use applyPageOptions() instead.
144-
*/
145-
public function processPDF(string $behavior, int $onMinPages, array $pageIndexes)
146-
{
147-
$this->applyPageOptions(new PageOptions($pageIndexes, $behavior, $onMinPages));
148-
}
149-
150131
/**
151132
* @param string $fileBytes Raw data as bytes.
152133
* @return void
153134
*/
154-
private function saveBytesAsFile(string $fileBytes)
135+
private function saveBytesAsFile(string $fileBytes): void
155136
{
156137
$cutPdfTempFile = tempnam(sys_get_temp_dir(), 'mindee_cut_pdf_');
157138
file_put_contents($cutPdfTempFile, $fileBytes);

src/Parsing/Common/Ocr/OcrPage.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ class OcrPage
2222
/**
2323
* Checks whether the words are on the same line.
2424
*
25-
* @param \Mindee\Parsing\Common\Ocr\OcrWord $currentWord Reference word to compare.
26-
* @param \Mindee\Parsing\Common\Ocr\OcrWord $nextWord Next word to compare.
25+
* @param OcrWord $currentWord Reference word to compare.
26+
* @param OcrWord $nextWord Next word to compare.
2727
* @return boolean
2828
*/
2929
private static function areWordsOnSameLine(OcrWord $currentWord, OcrWord $nextWord): bool
3030
{
31-
$currentInNext = PolygonUtils::isPointInPolygonY($currentWord->polygon->getCentroid(), $nextWord->polygon);
32-
$nextInCurrent = PolygonUtils::isPointInPolygonY($nextWord->polygon->getCentroid(), $currentWord->polygon);
31+
$currentInNext = $nextWord->polygon->isPointInY($currentWord->polygon->getCentroid());
32+
$nextInCurrent = $currentWord->polygon->isPointInY($nextWord->polygon->getCentroid());
3333
return $currentInNext || $nextInCurrent;
3434
}
3535

3636
/**
3737
* Compares word positions on the X axis. Returns a sort-compliant result (0;-1;1).
3838
*
39-
* @param \Mindee\Parsing\Common\Ocr\OcrWord $word1 First word.
40-
* @param \Mindee\Parsing\Common\Ocr\OcrWord $word2 Second word.
39+
* @param OcrWord $word1 First word.
40+
* @param OcrWord $word2 Second word.
4141
* @return integer
4242
*/
4343
public static function getMinMaxX(OcrWord $word1, OcrWord $word2): int
@@ -53,8 +53,8 @@ public static function getMinMaxX(OcrWord $word1, OcrWord $word2): int
5353
/**
5454
* Compares word positions on the Y axis. Returns a sort-compliant result (0;-1;1).
5555
*
56-
* @param \Mindee\Parsing\Common\Ocr\OcrWord $word1 First word.
57-
* @param \Mindee\Parsing\Common\Ocr\OcrWord $word2 Second word.
56+
* @param OcrWord $word1 First word.
57+
* @param OcrWord $word2 Second word.
5858
* @return integer
5959
*/
6060
public static function getMinMaxY(OcrWord $word1, OcrWord $word2): int

0 commit comments

Comments
 (0)