Skip to content

Commit

Permalink
Added "isAny()" function to "PdfBorder" class.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Aug 2, 2024
1 parent 6fd2694 commit ac685b4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## Unreleased

- Added `isAny()` function to `PdfBorder` class.

## 1.9.0.8 - 2024-08-02

- Added `draw()` function to `PdfBorder` class.
Expand Down
11 changes: 11 additions & 0 deletions src/PdfBorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ public function isAll(): bool
&& $this->bottom;
}

/**
* Gets a value indicating if at least one border is set.
*/
public function isAny(): bool
{
return $this->left
|| $this->right
|| $this->top
|| $this->bottom;
}

/**
* Gets a value indicating if the bottom border is set.
*/
Expand Down
10 changes: 10 additions & 0 deletions tests/PdfBorderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ public function testIsAll(): void
self::assertTrue($actual->isAll());
}

public function testIsAny(): void
{
$actual = PdfBorder::none();
self::assertFalse($actual->isAny());
$actual = PdfBorder::all();
self::assertTrue($actual->isAny());
$actual = PdfBorder::left();
self::assertTrue($actual->isAny());
}

public function testLeft(): void
{
$actual = PdfBorder::left();
Expand Down

0 comments on commit ac685b4

Please sign in to comment.