Skip to content

Commit 16f2e3f

Browse files
committed
fix(pages): remove duplicated declared-count recovery method
1 parent ad64bdc commit 16f2e3f

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

src/Smalot/PdfParser/Pages.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -242,41 +242,6 @@ protected function recoverByDeclaredCount(array $pages): array
242242
return $pages;
243243
}
244244

245-
/**
246-
* @param array<Page> $pages
247-
*
248-
* @return array<Page>
249-
*/
250-
protected function recoverByDeclaredCount(array $pages): array
251-
{
252-
if (!$this->has('Count') || 0 === \count($pages)) {
253-
return $pages;
254-
}
255-
256-
$countElement = $this->get('Count');
257-
if (!\is_object($countElement) || !method_exists($countElement, 'getContent')) {
258-
return $pages;
259-
}
260-
261-
$declaredCount = (int) $countElement->getContent();
262-
$actualCount = \count($pages);
263-
264-
if ($declaredCount <= $actualCount) {
265-
return $pages;
266-
}
267-
268-
if (($declaredCount - $actualCount) > 10) {
269-
return $pages;
270-
}
271-
272-
$lastPage = $pages[$actualCount - 1];
273-
while (\count($pages) < $declaredCount) {
274-
$pages[] = $lastPage;
275-
}
276-
277-
return $pages;
278-
}
279-
280245
/**
281246
* Gathers information about fonts and collects them in a list.
282247
*

0 commit comments

Comments
 (0)