Browse Source

update Connection::setRequest API

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

5
src/Interface/Model/Connection.php

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

6
src/Model/Connection/Gemini.php

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

Loading…
Cancel
Save