Browse Source

update Connection::setRequest API

PHP-GTK3
yggverse 5 months ago
parent
commit
f271761668
  1. 29
      src/Abstract/Model/Connection.php
  2. 5
      src/Interface/Model/Connection.php
  3. 6
      src/Model/Connection/Gemini.php

29
src/Abstract/Model/Connection.php

@ -7,16 +7,16 @@ namespace Yggverse\Yoda\Abstract\Model;
abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
{ {
// Status // Status
protected bool $_completed = false; private bool $_completed = false;
// Response // Response
protected ?string $_title = null; private ?string $_title = null;
protected ?string $_subtitle = null; private ?string $_subtitle = null;
protected ?string $_tooltip = null; private ?string $_tooltip = null;
protected ?string $_mime = null; private ?string $_mime = null;
protected ?string $_data = null; private ?string $_data = null;
protected ?string $_redirect = null; private ?string $_redirect = null;
protected ?array $_request = null; private ?array $_request = null;
public function isCompleted(): bool public function isCompleted(): bool
{ {
@ -108,10 +108,19 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
} }
public function setRequest( public function setRequest(
?array $request = null ?string $placeholder,
bool $visible = true
): void ): void
{ {
$this->_request = $request; // @TODO $this->_request = [
'placeholder' => $placeholder,
'visible' => $visible
];
}
public function unsetRequest(): void
{
$this->_request = null;
} }
public function getLength(): ?int public function getLength(): ?int

5
src/Interface/Model/Connection.php

@ -63,8 +63,11 @@ interface Connection
public function getRequest(): ?array; public function getRequest(): ?array;
public function setRequest( public function setRequest(
?array $request = null ?string $placeholder,
bool $visible = true
): void; ): void;
public function unsetRequest(): void;
public function getLength(): ?int; public function getLength(): ?int;
} }

6
src/Model/Connection/Gemini.php

@ -47,10 +47,8 @@ class Gemini
); );
$this->_connection->setRequest( $this->_connection->setRequest(
[ $response->getMeta(),
'placeholder' => $response->getMeta(), 11 !== $response->getCode()
'visible' => 11 !== $response->getCode()
]
); );
break; break;

Loading…
Cancel
Save