Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split columns to data object and renderer #134

Merged
merged 10 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"php": "^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"psr/container": "^1.0|^2.0",
"yiisoft/arrays": "^2.0|^3.0",
"yiisoft/data": "dev-master",
"yiisoft/factory": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/BaseListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
private string $layoutGridTable = "{items}\n{summary}\n{pager}";
private string $pagination = '';
protected ?ReadableDataInterface $dataReader = null;
private array $sortLinkAttributes = [];
protected array $sortLinkAttributes = [];
private ?string $summary = null;
private array $summaryAttributes = [];
private string $toolbar = '';
Expand Down Expand Up @@ -332,7 +332,7 @@
*
* @param bool $value Whether container is enabled or not.
*/
public function withContainer(bool $value = true): static

Check warning on line 335 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * * @param bool $value Whether container is enabled or not. */ - public function withContainer(bool $value = true) : static + public function withContainer(bool $value = false) : static { $new = clone $this; $new->withContainer = $value;

Check warning on line 335 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * * @param bool $value Whether container is enabled or not. */ - public function withContainer(bool $value = true) : static + public function withContainer(bool $value = false) : static { $new = clone $this; $new->withContainer = $value;
{
$new = clone $this;
$new->withContainer = $value;
Expand Down Expand Up @@ -392,7 +392,7 @@
public function render(): string
{
if ($this->dataReader === null) {
throw new DataReaderNotSetException();

Check warning on line 395 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Throw_": --- Original +++ New @@ @@ public function render() : string { if ($this->dataReader === null) { - throw new DataReaderNotSetException(); + new DataReaderNotSetException(); } return $this->renderGrid(); }

Check warning on line 395 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Throw_": --- Original +++ New @@ @@ public function render() : string { if ($this->dataReader === null) { - throw new DataReaderNotSetException(); + new DataReaderNotSetException(); } return $this->renderGrid(); }
}

return $this->renderGrid();
Expand Down Expand Up @@ -456,7 +456,7 @@
);
}

return match ($this->withContainer) {

Check warning on line 459 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 459 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), }; } private function renderGridTable() : string
true => trim(
$contentGrid . PHP_EOL . Div::tag()
->attributes($attributes)
Expand All @@ -464,7 +464,7 @@
->encode(false)
->render()
),
false => trim($contentGrid . PHP_EOL . $this->renderGridTable()),

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim(PHP_EOL . $contentGrid . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim(PHP_EOL . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim($contentGrid . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim($contentGrid . $this->renderGridTable() . PHP_EOL), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim($contentGrid . PHP_EOL), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => $contentGrid . PHP_EOL . $this->renderGridTable(), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim(PHP_EOL . $contentGrid . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim(PHP_EOL . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim($contentGrid . $this->renderGridTable()), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim($contentGrid . $this->renderGridTable() . PHP_EOL), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => trim($contentGrid . PHP_EOL), }; } private function renderGridTable() : string

Check warning on line 467 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ } return match ($this->withContainer) { true => trim($contentGrid . PHP_EOL . Div::tag()->attributes($attributes)->content(PHP_EOL . $this->renderGridTable() . PHP_EOL)->encode(false)->render()), - false => trim($contentGrid . PHP_EOL . $this->renderGridTable()), + false => $contentGrid . PHP_EOL . $this->renderGridTable(), }; } private function renderGridTable() : string
};
}

Expand All @@ -475,7 +475,7 @@
$this->layoutGridTable,
[
'{header}' => $this->renderHeader(),
'{toolbar}' => $this->toolbar,

Check warning on line 478 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ArrayItem": --- Original +++ New @@ @@ } private function renderGridTable() : string { - return trim(strtr($this->layoutGridTable, ['{header}' => $this->renderHeader(), '{toolbar}' => $this->toolbar, '{items}' => $this->renderItems(), '{summary}' => $this->renderSummary(), '{pager}' => $this->renderPagination()])); + return trim(strtr($this->layoutGridTable, ['{header}' => $this->renderHeader(), '{toolbar}' > $this->toolbar, '{items}' => $this->renderItems(), '{summary}' => $this->renderSummary(), '{pager}' => $this->renderPagination()])); } private function renderHeader() : string {

Check warning on line 478 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ArrayItem": --- Original +++ New @@ @@ } private function renderGridTable() : string { - return trim(strtr($this->layoutGridTable, ['{header}' => $this->renderHeader(), '{toolbar}' => $this->toolbar, '{items}' => $this->renderItems(), '{summary}' => $this->renderSummary(), '{pager}' => $this->renderPagination()])); + return trim(strtr($this->layoutGridTable, ['{header}' => $this->renderHeader(), '{toolbar}' > $this->toolbar, '{items}' => $this->renderItems(), '{summary}' => $this->renderSummary(), '{pager}' => $this->renderPagination()])); } private function renderHeader() : string {
'{items}' => $this->renderItems(),
'{summary}' => $this->renderSummary(),
'{pager}' => $this->renderPagination(),
Expand Down
354 changes: 0 additions & 354 deletions src/Column/AbstractColumn.php

This file was deleted.

Loading