CodeBlockFormatter

namespace

bhenk\doc2rst\format

predicates

Cloneable | Instantiable

implements

Stringable

extends

AbstractFormatter

hierarchy

CodeBlockFormatter -> AbstractFormatter

Renders a code block

This nameless formatter is handling everything between 3 tics that start on a new line and that are not followed by a formatter name. The block is ended with 3 tics on a new line.

syntax

```
<code>
   <more code>
(...)
```

This is the result:

<code>
   <more code>
(...)

Methods

CodeBlockFormatter::handleLine

predicates

public

implements

AbstractFormatter::handleLine

@inheritdoc

Handle a line of PHPDoc

As long as the formatter wants more lines it should return true. When it has enough it should return false.

param string $line - line to format
return bool - true if more lines are welcome, false otherwise

@inheritdoc from method AbstractFormatter::handleLine

public function handleLine(
      Parameter #0 [ <required> string $line ]
 ): bool
param string $line - line of a code block
return bool - true as long as second and following lines do not start with 3 tics

CodeBlockFormatter::addLine

predicates

protected

inherited from

AbstractFormatter::addLine

Add a line to the resulting block

protected function addLine(
      Parameter #0 [ <required> Stringable|string $line ]
 ): void
param Stringable | string $line - the line to add
return void

CodeBlockFormatter::__toString

predicates

public

implements

Stringable::__toString

inherited from

AbstractFormatter::__toString

Returns a reStructuredText representation of the contents of the block

public function __toString(): string
return string - reStructuredText representation of the contents

CodeBlockFormatter::getLineCount

predicates

protected

inherited from

AbstractFormatter::getLineCount

protected function getLineCount(): int
return int

CodeBlockFormatter::increaseLineCount

predicates

protected

inherited from

AbstractFormatter::increaseLineCount

protected function increaseLineCount(): int
return int

Fri, 31 Mar 2023 13:22:46 +0000