Packet Class

class Packet

Represents a Packet diagram

render(array $attributes)

Render the Mermaid code enclosed in a <pre> tag

param array $attributes:

HTML attributes for the enclosing <pre> tag

returns:

Mermaid code enclosed in a <pre> tag

Return type:

string

addField(Field ...$field)

Add packet field(s)

Parameters:
  • ...$field (Field) – The packet field(s)

Returns:

A new instance of Packet with the fields added to existing fields

Return type:

Packet

render(array $attributes = [])

Renders the diagram

Parameters:
  • $attributes (array) –

    HTML attributes for the <pre> tag as name=>value pairs

    Note

    The mermaid class is added

Returns:

Mermaid diagram code in a <pre> tag

Return type:

string

withField(Field ...$field)

Set packet field(s)

Parameters:
  • ...$field (Field) – The packet field(s)

Returns:

A new instance of Packet with the fields

Return type:

Packet

withTitle(string $title)

Set the diagram title

Parameters:
  • $title (string) – The title

Returns:

A new instance of Packet with the title

Return type:

Packet