Skip to content

Commit

Permalink
feat(parsers): update parsers #199
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Aug 1, 2021
1 parent eff0bbb commit d15af2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/flextype/Support/Parsers/Markdown.php
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions src/flextype/Support/Parsers/Parsers.php
Expand Up @@ -10,6 +10,8 @@
namespace Flextype\Support\Parsers;

use Atomastic\Macroable\Macroable;
use Flextype\Support\Parsers\Markdown;
use Flextype\Support\Parsers\Shortcodes;

class Parsers
{
Expand All @@ -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();
}
}

0 comments on commit d15af2d

Please sign in to comment.