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. 11
      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
// Dependencies // Dependencies
public Content $content; public Content $content;
// Extras
protected ?string $_source = null;
// Defaults // Defaults
public const WRAP = 140; public const WRAP = 140;
// Extras
protected int $_wrap = self::WRAP;
protected ?string $_source = null;
public function __construct( public function __construct(
Content $content Content $content
) { ) {

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

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

Loading…
Cancel
Save