Browse Source

rename buffer to pool

PHP-GTK3
yggverse 5 months ago
parent
commit
4eeb7b3971
  1. 62
      src/Abstract/Model/Connection.php
  2. 4
      src/Interface/Model/Connection.php
  3. 2
      src/Interface/Model/Pool.php

62
src/Abstract/Model/Connection.php

@ -4,54 +4,54 @@ declare(strict_types=1); @@ -4,54 +4,54 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Model;
use \Yggverse\Yoda\Model\Buffer;
use \Yggverse\Yoda\Model\Pool;
abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
{
private Buffer $_buffer;
private Pool $_pool;
public function __construct(
Buffer $buffer
Pool $pool
) {
// Use shared memory for async operations
$this->_buffer = $buffer;
// Use shared memory pool for async operations
$this->_pool = $pool;
// Set defaults
$this->_buffer->set(
$this->_pool->set(
'completed',
false
);
$this->_buffer->set(
$this->_pool->set(
'title',
null
);
$this->_buffer->set(
$this->_pool->set(
'subtitle',
null
);
$this->_buffer->set(
$this->_pool->set(
'tooltip',
null
);
$this->_buffer->set(
$this->_pool->set(
'mime',
null
);
$this->_buffer->set(
$this->_pool->set(
'data',
null
);
$this->_buffer->set(
$this->_pool->set(
'redirect',
null
);
$this->_buffer->set(
$this->_pool->set(
'request',
null
);
@ -59,7 +59,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -59,7 +59,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function isCompleted(): bool
{
return $this->_buffer->get(
return $this->_pool->get(
'completed'
);
}
@ -68,7 +68,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -68,7 +68,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
bool $completed
): void
{
$this->_buffer->set(
$this->_pool->set(
'completed',
$completed
);
@ -76,7 +76,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -76,7 +76,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getTitle(): ?string
{
return $this->_buffer->get(
return $this->_pool->get(
'title'
);
}
@ -85,7 +85,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -85,7 +85,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
?string $title = null
): void
{
$this->_buffer->set(
$this->_pool->set(
'title',
$title
);
@ -93,7 +93,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -93,7 +93,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getSubtitle(): ?string
{
return $this->_buffer->get(
return $this->_pool->get(
'subtitle'
);
}
@ -102,7 +102,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -102,7 +102,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
?string $subtitle = null
): void
{
$this->_buffer->set(
$this->_pool->set(
'subtitle',
$subtitle
);
@ -110,7 +110,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -110,7 +110,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getTooltip(): ?string
{
return $this->_buffer->get(
return $this->_pool->get(
'tooltip'
);
}
@ -119,7 +119,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -119,7 +119,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
?string $tooltip = null
): void
{
$this->_buffer->set(
$this->_pool->set(
'tooltip',
$tooltip
);
@ -127,7 +127,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -127,7 +127,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getMime(): ?string
{
return $this->_buffer->get(
return $this->_pool->get(
'mime'
);
}
@ -136,7 +136,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -136,7 +136,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
?string $mime = null
): void
{
$this->_buffer->set(
$this->_pool->set(
'mime',
$mime
);
@ -144,7 +144,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -144,7 +144,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getData(): ?string
{
return $this->_buffer->get(
return $this->_pool->get(
'data'
);
}
@ -153,7 +153,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -153,7 +153,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
?string $data = null
): void
{
$this->_buffer->set(
$this->_pool->set(
'data',
$data
);
@ -161,7 +161,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -161,7 +161,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getRedirect(): ?string
{
return $this->_buffer->get(
return $this->_pool->get(
'redirect'
);
}
@ -170,7 +170,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -170,7 +170,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
?string $redirect = null
): void
{
$this->_buffer->set(
$this->_pool->set(
'redirect',
$redirect
);
@ -178,7 +178,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -178,7 +178,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getRequest(): ?array
{
return $this->_buffer->get(
return $this->_pool->get(
'request'
);
}
@ -188,7 +188,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -188,7 +188,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
bool $visible = true
): void
{
$this->_buffer->set(
$this->_pool->set(
'request',
[
'placeholder' => $placeholder,
@ -199,7 +199,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -199,7 +199,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function unsetRequest(): void
{
$this->_buffer->set(
$this->_pool->set(
'request',
null
);
@ -208,7 +208,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection @@ -208,7 +208,7 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
public function getLength(): ?int
{
return mb_strlen(
$this->_buffer->get(
$this->_pool->get(
'data'
)
);

4
src/Interface/Model/Connection.php

@ -10,6 +10,10 @@ namespace Yggverse\Yoda\Interface\Model; @@ -10,6 +10,10 @@ namespace Yggverse\Yoda\Interface\Model;
*/
interface Connection
{
public function __construct(
\Yggverse\Yoda\Interface\Model\Pool $pool
);
public function request(
string $request,
int $timeout = 5

2
src/Interface/Model/Buffer.php → src/Interface/Model/Pool.php

@ -8,7 +8,7 @@ namespace Yggverse\Yoda\Interface\Model; @@ -8,7 +8,7 @@ namespace Yggverse\Yoda\Interface\Model;
* Shared memory API for async operations
*
*/
interface Buffer
interface Pool
{
public function get(
string $key
Loading…
Cancel
Save