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\ContentType;
use Jolicht\MarkdownCms\Markdown\MarkdownDocument;
class ContentCreator
{
* Options
* @var array
private $options;
* Constructor
* @param array $options
public function __construct(array $options)
$this->options = $options;
}
* Get content type
* @param MarkdownDocument $document
* @return ContentTypeInterface
public function __invoke(MarkdownDocument $document) : ContentTypeInterface
$options = $this->getOptions();
$type = $document->getParam('type', $options['content_type_default']);
$class = $options['content_types'][$type]['creator'];
$creator = new $class($options['content_types'][$type]['default_template']);
return $creator($document);
* Get options
* @return array
public function getOptions() : array
return $this->options;