From 0f01ecde96ab989a1fad414126a7e6aa464fc024 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 22 Jul 2024 00:39:40 +0300 Subject: [PATCH] fix use const --- .../Browser/Container/Page/Response/Query.php | 2 +- .../Browser/Container/Page/Response/Send.php | 2 +- src/Entity/Browser/Header.php | 26 +++++++++---------- src/Entity/Browser/Header/Tray.php | 12 ++++----- src/Entity/Browser/History/Header.php | 13 +++++----- 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/Entity/Browser/Container/Page/Response/Query.php b/src/Entity/Browser/Container/Page/Response/Query.php index 793e6ca7..454e87d5 100644 --- a/src/Entity/Browser/Container/Page/Response/Query.php +++ b/src/Entity/Browser/Container/Page/Response/Query.php @@ -11,7 +11,7 @@ class Query extends \Yggverse\Yoda\Abstract\Entity\Entry public Response $response; // Defaults - protected string $_placeholder = 'Enter response...'; + public const PLACEHOLDER = 'Enter your response...'; public function __construct( Response $response diff --git a/src/Entity/Browser/Container/Page/Response/Send.php b/src/Entity/Browser/Container/Page/Response/Send.php index 7526ac65..3834c702 100644 --- a/src/Entity/Browser/Container/Page/Response/Send.php +++ b/src/Entity/Browser/Container/Page/Response/Send.php @@ -12,7 +12,7 @@ class Send extends \Yggverse\Yoda\Abstract\Entity\Button public Response $response; // Defaults - protected string $_label = 'Send'; + public const LABEL = 'Send'; public function __construct( Response $response diff --git a/src/Entity/Browser/Header.php b/src/Entity/Browser/Header.php index a3cf68fe..80272a52 100644 --- a/src/Entity/Browser/Header.php +++ b/src/Entity/Browser/Header.php @@ -17,9 +17,9 @@ class Header public Header\Tray $tray; // Defaults - protected bool $_actions = true; - protected string $_title = 'Yoda'; - protected string $_subtitle = ''; + public const ACTIONS = true; + public const TITLE = 'Yoda'; + public const SUBTITLE = ''; public function __construct( Browser $browser @@ -31,15 +31,15 @@ class Header $this->gtk = new \GtkHeaderBar; $this->gtk->set_show_close_button( - $this->_actions + $this::ACTIONS ); $this->gtk->set_title( - $this->_title + $this::TITLE ); $this->gtk->set_subtitle( - $this->_subtitle + $this::SUBTITLE ); // Init tray area @@ -56,17 +56,17 @@ class Header } public function setTitle( - ?string $value = null, + ?string $title = null, ?string $subtitle = null ): void { $this->gtk->set_title( - is_null($value) ? $this->_title : sprintf( + is_null($title) ? $this::TITLE : sprintf( '%s - %s', trim( - $value + $title ), - $this->_title + $this::TITLE ) ); @@ -76,12 +76,12 @@ class Header } public function setSubtitle( - ?string $value = null + ?string $subtitle = null ): void { $this->gtk->set_subtitle( - is_null($value) ? $this->_subtitle : trim( - $value + is_null($subtitle) ? $this::SUBTITLE : trim( + $subtitle ) ); } diff --git a/src/Entity/Browser/Header/Tray.php b/src/Entity/Browser/Header/Tray.php index 1940cb47..d205eef3 100644 --- a/src/Entity/Browser/Header/Tray.php +++ b/src/Entity/Browser/Header/Tray.php @@ -18,10 +18,8 @@ class Tray public Tray\Tab $tab; // Defaults - protected bool $_actions = true; - protected string $_title = 'Yoda'; - protected string $_subtitle = ''; - protected int $_margin = 8; + public const MARGIN = 4; + public const SPACING = 8; public function __construct( Header $header @@ -35,15 +33,15 @@ class Tray ); $this->gtk->set_margin_start( - $this->_margin / 2 + $this::MARGIN ); $this->gtk->set_margin_end( - $this->_margin / 2 + $this::MARGIN ); $this->gtk->set_spacing( - $this->_margin + $this::SPACING ); // Init navigation diff --git a/src/Entity/Browser/History/Header.php b/src/Entity/Browser/History/Header.php index b9cf1548..edf7c0b8 100644 --- a/src/Entity/Browser/History/Header.php +++ b/src/Entity/Browser/History/Header.php @@ -8,27 +8,26 @@ class Header { public \GtkHeaderBar $gtk; - protected bool $_actions = true; - protected string $_title = 'History - Yoda'; - protected string $_subtitle = ''; + public const ACTIONS = true; + public const TITLE = 'History - Yoda'; + public const SUBTITLE = ''; public function __construct() { $this->gtk = new \GtkHeaderBar; $this->gtk->set_show_close_button( - $this->_actions + $this::ACTIONS ); $this->gtk->set_title( - $this->_title + _($this::TITLE) ); $this->gtk->set_subtitle( - $this->_subtitle + _($this::SUBTITLE) ); - // Render $this->gtk->show(); } } \ No newline at end of file