From d15af2dddc992dcf6b0dbaf281aa45e273b25110 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 1 Aug 2021 12:30:12 +0300 Subject: [PATCH] feat(parsers): update parsers #199 --- src/flextype/Support/Parsers/Markdown.php | 8 ++++---- src/flextype/Support/Parsers/Parsers.php | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/flextype/Support/Parsers/Markdown.php b/src/flextype/Support/Parsers/Markdown.php index 490f4e9ba5..07f3612e17 100644 --- a/src/flextype/Support/Parsers/Markdown.php +++ b/src/flextype/Support/Parsers/Markdown.php @@ -60,7 +60,7 @@ public function __wakeup(): void */ protected function __construct() { - $config = flextype('registry')->get('flextype.settings.parsers.markdown'); + $config = registry()->get('flextype.settings.parsers.markdown'); $this->environment = Environment::createCommonMarkEnvironment(); $this->environment->addExtension(new AttributesExtension()); $this->environment->addExtension(new TableExtension()); @@ -106,15 +106,15 @@ public static function getInstance(): Markdown */ public function parse(string $input, bool $cache = true) { - if ($cache === true && flextype('registry')->get('flextype.settings.cache.enabled') === true) { + if ($cache === true && registry()->get('flextype.settings.cache.enabled') === true) { $key = $this->getCacheID($input); - if ($dataFromCache = flextype('cache')->get($key)) { + if ($dataFromCache = cache()->get($key)) { return $dataFromCache; } $data = $this->converter()->convertToHtml($input); - flextype('cache')->set($key, $data); + cache()->set($key, $data); return $data; } diff --git a/src/flextype/Support/Parsers/Parsers.php b/src/flextype/Support/Parsers/Parsers.php index 66b5f07673..99331df97f 100644 --- a/src/flextype/Support/Parsers/Parsers.php +++ b/src/flextype/Support/Parsers/Parsers.php @@ -10,6 +10,8 @@ namespace Flextype\Support\Parsers; use Atomastic\Macroable\Macroable; +use Flextype\Support\Parsers\Markdown; +use Flextype\Support\Parsers\Shortcodes; class Parsers { @@ -24,10 +26,10 @@ public function markdown(): Markdown } /** - * Create a Shortcode instance. + * Create a Shortcodes instance. */ - public function shortcode(): Shortcode + public function shortcodes(): Shortcodes { - return Shortcode::getInstance(); + return Shortcodes::getInstance(); } }