Browse Source

define wrap storage

PHP-GTK3
yggverse 4 months ago
parent
commit
3186ac6846
  1. 7
      src/Abstract/Entity/Browser/Container/Page/Content/Markup.php
  2. 19
      src/Entity/Browser/Container/Page/Content/Gemtext.php

7
src/Abstract/Entity/Browser/Container/Page/Content/Markup.php

@ -16,12 +16,13 @@ abstract class Markup @@ -16,12 +16,13 @@ abstract class Markup
// Dependencies
public Content $content;
// Extras
protected ?string $_source = null;
// Defaults
public const WRAP = 140;
// Extras
protected int $_wrap = self::WRAP;
protected ?string $_source = null;
public function __construct(
Content $content
) {

19
src/Entity/Browser/Container/Page/Content/Gemtext.php

@ -315,15 +315,20 @@ class Gemtext extends Markup @@ -315,15 +315,20 @@ class Gemtext extends Markup
}
private function _wrap(
string $value
string $source
): string
{
return wordwrap(
$value,
$this::WRAP,
PHP_EOL,
false
);
if ($wrap = $this->_wrap ? $this->_wrap : $this::WRAP)
{
return wordwrap(
$source,
$wrap,
PHP_EOL,
false
);
}
throw new Exception;
}
private function _url(

Loading…
Cancel
Save