for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Lichtenwallner (https://lichtenwallner.at)
*
* @see https://github.com/jolicht/markdown-cms for the canonical source repository
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
* @copyright Copyright (c) Johannes Lichtenwallner
*/
declare(strict_types = 1);
namespace Jolicht\MarkdownCms\Parser;
use Jolicht\MarkdownCms\Parser\Observer\ParsedContentObserverInterface;
class ParseContentExecutor
{
* Content parser
* @var ContentParser
private $contentParser;
* Observers
* @var array
private $observers = [];
* Constructor
* @param ContentParser $contentParser
public function __construct(ContentParser $contentParser)
$this->contentParser = $contentParser;
}
public function __invoke()
$config = ($this->getContentParser())();
foreach ($this->getObservers() as $observer) {
$observer($config);
* Get content parser
* @return ContentParser
public function getContentParser() : ContentParser
return $this->contentParser;
* Get observers
* @return array
public function getObservers() : array
return $this->observers;
* Add observer
* @param ParsedContentObserverInterface $observer
public function addObserver(ParsedContentObserverInterface $observer)
$this->observers[] = $observer;