Gumdrop\PageConfiguration::extractPageHeader PHP Метод

extractPageHeader() публичный Метод

public extractPageHeader ( $content )
    public function extractPageHeader($content)
    {
        $count = preg_match('#^\\*\\*\\*\\n(.*)\\n\\*\\*\\*\\n(.*)$#sUD', $content, $matches);
        if ($count == 1) {
            $this->configuration = json_decode($matches[1], true);
            if (json_last_error() != JSON_ERROR_NONE) {
                throw new Exception('Invalid configuration');
            }
            return $matches[2];
        }
        return $content;
    }

Usage Example

Пример #1
0
 public function setConfiguration(\Gumdrop\PageConfiguration $configuration)
 {
     $this->setMarkdownContent($configuration->extractPageHeader($this->getMarkdownContent()));
     $this->configuration = $configuration;
 }
PageConfiguration