Skip to content

Commit

Permalink
Fix firts page typo (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
particleflux authored Oct 10, 2023
1 parent 90895a9 commit 13e8e93
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
44 changes: 22 additions & 22 deletions src/OffsetPagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@

final class OffsetPagination extends BasePagination
{
private bool $disabledFirtsPage = false;
private bool $disabledFirstPage = false;
private bool $disabledLastPage = false;
private bool $disabledPageNavLink = false;
private string $iconFirtsPage = '';
private string $iconClassFirtsPage = '';
private string $iconFirstPage = '';
private string $iconClassFirstPage = '';
private string $iconClassLastPage = '';
private string $iconLastPage = '';
private string $labelFirtsPage = '';
private string $labelFirstPage = '';
private string $labelLastPage = '';
private int $maxNavLinkCount = 10;

/**
* Return a new instance with disabled first page.
*/
public function disabledFirtsPage(bool $value): self
public function disabledFirstPage(bool $value): self
{
$new = clone $this;
$new->disabledFirtsPage = $value;
$new->disabledFirstPage = $value;

return $new;
}
Expand Down Expand Up @@ -68,15 +68,15 @@ public function disabledPageNavLink(bool $value): self
}

/**
* Returns a new instance with the icon class for icon attributes `<i>` for link firts page.
* Returns a new instance with the icon class for icon attributes `<i>` for link first page.
*
* @param string $value The icon class.
*/
public function iconClassFirtsPage(string $value): self
public function iconClassFirstPage(string $value): self
{
$new = clone $this;
$new->iconClassFirtsPage = $value;
$new->labelFirtsPage = '';
$new->iconClassFirstPage = $value;
$new->labelFirstPage = '';

return $new;
}
Expand All @@ -96,15 +96,15 @@ public function iconClassLastPage(string $value): self
}

/**
* Return a new instance with icon firts page.
* Return a new instance with icon first page.
*
* @param string $value The icon firts page.
* @param string $value The icon first page.
*/
public function iconFirtsPage(string $value): self
public function iconFirstPage(string $value): self
{
$new = clone $this;
$new->iconFirtsPage = $value;
$new->labelFirtsPage = '';
$new->iconFirstPage = $value;
$new->labelFirstPage = '';

return $new;
}
Expand All @@ -128,10 +128,10 @@ public function iconLastPage(string $value): self
*
* @param string $value The label for first page.
*/
public function labelFirtsPage(string $value = ''): self
public function labelFirstPage(string $value = ''): self
{
$new = clone $this;
$new->labelFirtsPage = $value;
$new->labelFirstPage = $value;

return $new;
}
Expand Down Expand Up @@ -238,14 +238,14 @@ private function renderFirstsPageNavLink(int $currentPage): array
$iconContainerAttributes['aria-hidden'] = 'true';
}

if ($this->labelFirtsPage !== '' || $this->iconFirtsPage !== '' || $this->iconClassFirtsPage !== '') {
if ($this->labelFirstPage !== '' || $this->iconFirstPage !== '' || $this->iconClassFirstPage !== '') {
$items = [
'disabled' => $currentPage === 1 || $this->disabledFirtsPage,
'icon' => $this->iconFirtsPage,
'disabled' => $currentPage === 1 || $this->disabledFirstPage,
'icon' => $this->iconFirstPage,
'iconAttributes' => $this->getIconAttributes(),
'iconClass' => $this->iconClassFirtsPage,
'iconClass' => $this->iconClassFirstPage,
'iconContainerAttributes' => $iconContainerAttributes,
'label' => $this->labelFirtsPage,
'label' => $this->labelFirstPage,
'link' => $this->createUrl(1),
];
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Pagination/Bootstrap5/OffsetPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testsDisabledAndActiveStates(): void
* @throws NotInstantiableException
* @throws CircularReferenceException
*/
public function testRenderWithIconFirtsLastPage(): void
public function testRenderWithIconFirstLastPage(): void
{
Assert::equalsWithoutLE(
<<<HTML
Expand All @@ -124,7 +124,7 @@ public function testRenderWithIconFirtsLastPage(): void
</nav>
HTML,
OffsetPagination::widget()
->iconFirtsPage('«')
->iconFirstPage('«')
->iconLastPage('»')
->paginator($this->createOffsetPaginator($this->data, 1))
->urlArguments([])
Expand All @@ -138,7 +138,7 @@ public function testRenderWithIconFirtsLastPage(): void
* @throws NotInstantiableException
* @throws CircularReferenceException
*/
public function testRenderWithIconClassFirtsLastPage(): void
public function testRenderWithIconClassFirstLastPage(): void
{
Assert::equalsWithoutLE(
<<<HTML
Expand All @@ -157,7 +157,7 @@ public function testRenderWithIconClassFirtsLastPage(): void
</nav>
HTML,
OffsetPagination::widget()
->iconClassFirtsPage('bi bi-chevron-double-left p-1')
->iconClassFirstPage('bi bi-chevron-double-left p-1')
->iconClassLastPage('bi bi-chevron-double-right p-1')
->paginator($this->createOffsetPaginator($this->data, 1))
->urlArguments([])
Expand All @@ -171,7 +171,7 @@ public function testRenderWithIconClassFirtsLastPage(): void
* @throws NotInstantiableException
* @throws CircularReferenceException
*/
public function testRenderWithLabelFirtsLastPage(): void
public function testRenderWithLabelFirstLastPage(): void
{
Assert::equalsWithoutLE(
<<<HTML
Expand All @@ -190,7 +190,7 @@ public function testRenderWithLabelFirtsLastPage(): void
</nav>
HTML,
OffsetPagination::widget()
->labelFirtsPage('First')
->labelFirstPage('First')
->labelLastPage('Last')
->paginator($this->createOffsetPaginator($this->data, 1))
->urlArguments([])
Expand Down
8 changes: 4 additions & 4 deletions tests/Pagination/ImmutableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public function render(): string
public function testOffsetPagination(): void
{
$offsetPagination = OffsetPagination::widget();
$this->assertNotSame($offsetPagination, $offsetPagination->disabledFirtsPage(false));
$this->assertNotSame($offsetPagination, $offsetPagination->disabledFirstPage(false));
$this->assertNotSame($offsetPagination, $offsetPagination->disabledLastPage(false));
$this->assertNotSame($offsetPagination, $offsetPagination->disabledPageNavLink(false));
$this->assertNotSame($offsetPagination, $offsetPagination->iconClassFirtsPage(''));
$this->assertNotSame($offsetPagination, $offsetPagination->iconClassFirstPage(''));
$this->assertNotSame($offsetPagination, $offsetPagination->iconClassLastPage(''));
$this->assertNotSame($offsetPagination, $offsetPagination->iconFirtsPage(''));
$this->assertNotSame($offsetPagination, $offsetPagination->iconFirstPage(''));
$this->assertNotSame($offsetPagination, $offsetPagination->iconLastPage(''));
$this->assertNotSame($offsetPagination, $offsetPagination->labelFirtsPage());
$this->assertNotSame($offsetPagination, $offsetPagination->labelFirstPage());
$this->assertNotSame($offsetPagination, $offsetPagination->labelLastPage());
$this->assertNotSame($offsetPagination, $offsetPagination->maxNavLinkCount(10));
}
Expand Down

0 comments on commit 13e8e93

Please sign in to comment.