Eno\Section » section

section($name) → Section or null
section($name, $options) → Section or null

Retrieve the subsection with the specified name from this current section.

eno# content
title: A Manifest

# notes
php$document = Parser::parse($input);

$document->section('content');   // returns [Section name="content" elements=1]
$document->section('notes');     // returns [Section name="notes" elements=0]
$document->section('metadata');  // throws a ValidationError

$document->section('metadata', [ 'required' => false ]);       // returns null
$document->section('notes', [ 'enforce_element' => true ]);     // returns [Section name="notes" elements=0]
$document->section('metadata', [ 'enforce_element' => true ]);  // throws a ValidationError

Parameters

$name

A string specifying the name of the section to retrieve.

$options

enforce_element

Whether the section must be present in the document (defaults to false)

required

Alias for enforce_element (this exists on many methods and depending on context refers to either element or value)

Return value

A Section, or null.