Browse Source

move MIME type constants to Filesystem model

PHP-GTK3
yggverse 5 months ago
parent
commit
fe3bec5caa
  1. 3
      src/Interface/Model/Connection.php
  2. 3
      src/Model/Connection.php
  3. 6
      src/Model/Connection/File.php
  4. 4
      src/Model/Connection/Gemini.php
  5. 5
      src/Model/Connection/Nex.php
  6. 3
      src/Model/Filesystem.php

3
src/Interface/Model/Connection.php

@ -21,9 +21,6 @@ interface Connection @@ -21,9 +21,6 @@ interface Connection
int $timeout = 5
): void;
public const MIME_TEXT_GEMINI = 'text/gemini';
public const MIME_TEXT_PLAIN = 'text/plain';
public function isCompleted(): bool;
public function setCompleted(

3
src/Model/Connection.php

@ -9,6 +9,7 @@ use \Yggverse\Net\Address; @@ -9,6 +9,7 @@ use \Yggverse\Net\Address;
use \Yggverse\Yoda\Model\Connection\File;
use \Yggverse\Yoda\Model\Connection\Gemini;
use \Yggverse\Yoda\Model\Connection\Nex;
use \Yggverse\Yoda\Model\Filesystem;
class Connection extends \Yggverse\Yoda\Abstract\Model\Connection
{
@ -115,7 +116,7 @@ class Connection extends \Yggverse\Yoda\Abstract\Model\Connection @@ -115,7 +116,7 @@ class Connection extends \Yggverse\Yoda\Abstract\Model\Connection
);
$this->setMime(
$this::MIME_TEXT_GEMINI
Filesystem::MIME_TEXT_GEMINI
);
$this->setCompleted(

6
src/Model/Connection/File.php

@ -61,7 +61,7 @@ class File @@ -61,7 +61,7 @@ class File
}
$this->_connection->setMime(
$this->_connection::MIME_TEXT_GEMINI
Filesystem::MIME_TEXT_GEMINI
);
$this->_connection->setData(
@ -94,7 +94,7 @@ class File @@ -94,7 +94,7 @@ class File
)
);
if ($this->_connection::MIME_TEXT_PLAIN == $this->_connection->getMime())
if (Filesystem::MIME_TEXT_PLAIN == $this->_connection->getMime())
{
$extension = pathinfo(
strval(
@ -106,7 +106,7 @@ class File @@ -106,7 +106,7 @@ class File
if (in_array($extension, ['gmi', 'gemini']))
{
$this->_connection->setMime(
$this->_connection::MIME_TEXT_GEMINI
Filesystem::MIME_TEXT_GEMINI
);
}
}

4
src/Model/Connection/Gemini.php

@ -44,7 +44,7 @@ class Gemini @@ -44,7 +44,7 @@ class Gemini
case 11: // sensitive input
$this->_connection->setMime(
$this->_connection::MIME_TEXT_GEMINI
Filesystem::MIME_TEXT_GEMINI
);
$this->_connection->setRequest(
@ -117,7 +117,7 @@ class Gemini @@ -117,7 +117,7 @@ class Gemini
);
$this->_connection->setMime(
$this->_connection::MIME_TEXT_GEMINI
Filesystem::MIME_TEXT_GEMINI
);
}

5
src/Model/Connection/Nex.php

@ -8,6 +8,7 @@ use \Yggverse\Net\Address; @@ -8,6 +8,7 @@ use \Yggverse\Net\Address;
use \Yggverse\Nex\Client;
use \Yggverse\Yoda\Model\Connection;
use \Yggverse\Yoda\Model\Filesystem;
class Nex
{
@ -43,7 +44,7 @@ class Nex @@ -43,7 +44,7 @@ class Nex
);
$this->_connection->setMime(
$this->_connection::MIME_TEXT_PLAIN
Filesystem::MIME_TEXT_PLAIN
);
}
@ -58,7 +59,7 @@ class Nex @@ -58,7 +59,7 @@ class Nex
);
$this->_connection->setMime(
$this->_connection::MIME_TEXT_GEMINI
Filesystem::MIME_TEXT_GEMINI
);
}

3
src/Model/Filesystem.php

@ -6,6 +6,9 @@ namespace Yggverse\Yoda\Model; @@ -6,6 +6,9 @@ namespace Yggverse\Yoda\Model;
class Filesystem
{
public const MIME_TEXT_GEMINI = 'text/gemini';
public const MIME_TEXT_PLAIN = 'text/plain';
private string $_base;
public function __construct(

Loading…
Cancel
Save