From aebcba8226ebe3d142714d07f6aa487eec85e3dd Mon Sep 17 00:00:00 2001 From: keeama13 Date: Thu, 11 Jan 2024 17:07:11 +0100 Subject: [PATCH 1/2] feat: input hidden --- src/NotFound/Layout/Inputs/LayoutInputHidden.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/NotFound/Layout/Inputs/LayoutInputHidden.php diff --git a/src/NotFound/Layout/Inputs/LayoutInputHidden.php b/src/NotFound/Layout/Inputs/LayoutInputHidden.php new file mode 100644 index 0000000..b39a3df --- /dev/null +++ b/src/NotFound/Layout/Inputs/LayoutInputHidden.php @@ -0,0 +1,10 @@ + Date: Thu, 18 Jan 2024 14:21:18 +0100 Subject: [PATCH 2/2] style: formatting --- src/NotFound/Layout/Elements/LayoutBreadcrumb.php | 8 ++++---- src/NotFound/Layout/Elements/LayoutPager.php | 2 +- src/NotFound/Layout/Elements/Table/LayoutTable.php | 12 ++++++------ .../Layout/Elements/Table/LayoutTableColumn.php | 2 +- src/NotFound/Layout/Inputs/LayoutInputTags.php | 2 +- src/NotFound/Layout/LayoutResponse.php | 2 +- src/NotFound/Layout/Responses/Redirect.php | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/NotFound/Layout/Elements/LayoutBreadcrumb.php b/src/NotFound/Layout/Elements/LayoutBreadcrumb.php index 144172a..4c80a0c 100644 --- a/src/NotFound/Layout/Elements/LayoutBreadcrumb.php +++ b/src/NotFound/Layout/Elements/LayoutBreadcrumb.php @@ -21,7 +21,7 @@ public function __construct() * * @return void */ - public function addHome(string $title = null, string $link = '/'): self + public function addHome(?string $title = null, string $link = '/'): self { $this->properties->items[] = (object) ['title' => $title ?? 'Home', 'link' => $link]; @@ -31,11 +31,11 @@ public function addHome(string $title = null, string $link = '/'): self /** * Add an item to the breadcrumbs. * - * @param mixed $title Title displayed on the UI - * @param mixed $link Link (optional) Last item should always be the current path en should not link anywhere. + * @param mixed $title Title displayed on the UI + * @param mixed $link Link (optional) Last item should always be the current path en should not link anywhere. * @return void */ - public function addItem(string $title, string $link = null): self + public function addItem(string $title, ?string $link = null): self { $this->properties->items[] = (object) ['title' => $title, 'link' => $link]; diff --git a/src/NotFound/Layout/Elements/LayoutPager.php b/src/NotFound/Layout/Elements/LayoutPager.php index ee630eb..ba631bf 100644 --- a/src/NotFound/Layout/Elements/LayoutPager.php +++ b/src/NotFound/Layout/Elements/LayoutPager.php @@ -4,7 +4,7 @@ class LayoutPager extends AbstractLayout { - public function __construct(int $totalItems, int $itemsPerPage = null) + public function __construct(int $totalItems, ?int $itemsPerPage = null) { parent::__construct(type: 'Pager'); diff --git a/src/NotFound/Layout/Elements/Table/LayoutTable.php b/src/NotFound/Layout/Elements/Table/LayoutTable.php index aaba0f9..6e18016 100644 --- a/src/NotFound/Layout/Elements/Table/LayoutTable.php +++ b/src/NotFound/Layout/Elements/Table/LayoutTable.php @@ -14,11 +14,11 @@ class LayoutTable extends AbstractLayout /** * __construct * - * @param array $headers An array of LayoutTableHeader elements. - * @param array $rows An array of LayoutTableRow elements. - * @param bool $sort Will we be able to sort rows on the frontend. - * @param bool $delete Will we be able to delete rows on the frontend. - * @param bool $edit Will we be able to edit rows on the frontend. + * @param array $headers An array of LayoutTableHeader elements. + * @param array $rows An array of LayoutTableRow elements. + * @param bool $sort Will we be able to sort rows on the frontend. + * @param bool $delete Will we be able to delete rows on the frontend. + * @param bool $edit Will we be able to edit rows on the frontend. * @return void */ public function __construct(bool $sort = true, bool $delete = true, bool $edit = true, bool $create = true) @@ -51,7 +51,7 @@ public function addRow(LayoutTableRow $row): self /** * Used for pagination to display the number of pages in total * - * @param $number number of items + * @param $number number of items */ public function setTotalItems(int $number) { diff --git a/src/NotFound/Layout/Elements/Table/LayoutTableColumn.php b/src/NotFound/Layout/Elements/Table/LayoutTableColumn.php index 1cba73e..15de0cc 100644 --- a/src/NotFound/Layout/Elements/Table/LayoutTableColumn.php +++ b/src/NotFound/Layout/Elements/Table/LayoutTableColumn.php @@ -12,7 +12,7 @@ class LayoutTableColumn { public function __construct( - public string $value, + public string|bool $value, public string $type = 'text', public object $properties = new stdClass() ) { diff --git a/src/NotFound/Layout/Inputs/LayoutInputTags.php b/src/NotFound/Layout/Inputs/LayoutInputTags.php index 088570a..c59fe34 100644 --- a/src/NotFound/Layout/Inputs/LayoutInputTags.php +++ b/src/NotFound/Layout/Inputs/LayoutInputTags.php @@ -14,7 +14,7 @@ class LayoutInputTags extends AbstractInput * Set the current value of the input select * The value must be an array of identifiers, most likely ids * - * @param int[] $value array of identifiers + * @param int[] $value array of identifiers * @return void */ public function setValue(mixed $value): self diff --git a/src/NotFound/Layout/LayoutResponse.php b/src/NotFound/Layout/LayoutResponse.php index 0131a5c..e2a6bd2 100644 --- a/src/NotFound/Layout/LayoutResponse.php +++ b/src/NotFound/Layout/LayoutResponse.php @@ -14,7 +14,7 @@ class LayoutResponse private ?string $nextRequest = null; - public function __construct(AbstractLayout $ui = null, Action $action = null) + public function __construct(?AbstractLayout $ui = null, ?Action $action = null) { $this->actions = new Collection(); $this->elements = new Collection(); diff --git a/src/NotFound/Layout/Responses/Redirect.php b/src/NotFound/Layout/Responses/Redirect.php index 10f934e..a4ae689 100644 --- a/src/NotFound/Layout/Responses/Redirect.php +++ b/src/NotFound/Layout/Responses/Redirect.php @@ -12,7 +12,7 @@ class Redirect extends Action /** * __construct * - * @param mixed $target The path to navigate to (without locale!) + * @param mixed $target The path to navigate to (without locale!) * @return void */ public function __construct(string $target)