mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
define wrap storage
This commit is contained in:
parent
ba7a56ca7e
commit
3186ac6846
2 changed files with 16 additions and 10 deletions
|
|
@ -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
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue