You are here

public function FrontMatter::__construct in Drupal 9

FrontMatter constructor.

Parameters

string $source: A string source.

string $serializer: The name of a class that implements \Drupal\Component\Serialization\SerializationInterface.

File

core/lib/Drupal/Component/FrontMatter/FrontMatter.php, line 89

Class

FrontMatter
Component for parsing front matter from a source.

Namespace

Drupal\Component\FrontMatter

Code

public function __construct(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml') {
  assert(is_subclass_of($serializer, SerializationInterface::class), sprintf('The $serializer parameter must reference a class that implements %s.', SerializationInterface::class));
  $this->serializer = $serializer;
  $this->source = $source;
}