-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TablewView and TableRow to make use object api (#32)
- Loading branch information
1 parent
dac8818
commit fb17880
Showing
10 changed files
with
182 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ parameters: | |
- bin | ||
- src | ||
- tests | ||
- views | ||
|
||
excludePaths: | ||
- tests/Fixture/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TomasVotruba\Lines\ValueObject; | ||
|
||
/** | ||
* @api used in templates | ||
*/ | ||
final class TableRow | ||
{ | ||
public function __construct( | ||
private readonly string $name, | ||
private readonly string $count, | ||
private readonly ?string $percent, | ||
private readonly bool $isChild, | ||
) { | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function getCount(): string | ||
{ | ||
return $this->count; | ||
} | ||
|
||
public function getPercent(): ?string | ||
{ | ||
return $this->percent; | ||
} | ||
|
||
public function isChild(): bool | ||
{ | ||
return $this->isChild; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TomasVotruba\Lines\ValueObject; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @api used in templates | ||
*/ | ||
final class TableView | ||
{ | ||
/** | ||
* @param TableRow[] $tableRows | ||
*/ | ||
public function __construct( | ||
private readonly string $title, | ||
private readonly string $label, | ||
private readonly array $tableRows, | ||
private readonly bool $shouldIncludeRelative = false, | ||
) { | ||
Assert::allIsInstanceOf($tableRows, TableRow::class); | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function getLabel(): string | ||
{ | ||
return $this->label; | ||
} | ||
|
||
public function isShouldIncludeRelative(): bool | ||
{ | ||
return $this->shouldIncludeRelative; | ||
} | ||
|
||
/** | ||
* @return TableRow[] | ||
*/ | ||
public function getRows(): array | ||
{ | ||
return $this->tableRows; | ||
} | ||
|
||
public function getTemplateFilePath(): string | ||
{ | ||
return __DIR__ . '/../../views/table.php'; | ||
} | ||
} |
Oops, something went wrong.