Documentation

PdbLog
in package
implements IteratorAggregate

This is a array format for describing logs from the parser and sync tools.

The format is simple - an array of pairs.

  1. the 'handle' - section, heading, message, query
  2. the contents, typically a string

For example:

[
   ['section', 'Tables'],
   ['heading', 'MISSING - Table ~sample'],
   ['query', 'CREATE TABLE ~sample (...)'],
   ['section', 'Errors'],
   ['message', 'Oh it was bad'],
]

This can be easily formatted to HTML, JSON, Markdown, CLI outputs, etc.

It's also possible to pick out the 'query' parts and run them separately. For example PdbSync includes a section called 'Fixes' that includes 'query' components. An interface could highlight this and provide a option to run these.

Note: PdbSync and PdbParser both compose their logs manually. That is, not using the helpers provided here.

Table of Contents

Interfaces

IteratorAggregate

Constants

HEADING  : mixed = 'heading'
MESSAGE  : mixed = 'message'
QUERY  : mixed = 'query'
SECTION  : mixed = 'section'

Properties

$errors  : array<string|int, string>
$log  : array<string|int, array{0: string, 1: string}>

Methods

__construct()  : mixed
getErrors()  : array<string|int, mixed>
getIterator()  : Traversable
getLog()  : array<string|int, mixed>
hasErrors()  : bool
heading()  : mixed
html()  : string
Render a log as HTML.
isEmpty()  : bool
message()  : mixed
print()  : void
Print the log to the console.
query()  : mixed
section()  : mixed

Constants

HEADING

public mixed HEADING = 'heading'

MESSAGE

public mixed MESSAGE = 'message'

QUERY

public mixed QUERY = 'query'

SECTION

public mixed SECTION = 'section'

Properties

$errors

protected array<string|int, string> $errors = []

$log

protected array<string|int, array{0: string, 1: string}> $log = []

Methods

__construct()

public __construct([array<string|int, mixed> $log = [] ]) : mixed
Parameters
$log : array<string|int, mixed> = []

getErrors()

public getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>

getIterator()

public getIterator() : Traversable
Tags
inheritdoc
Return values
Traversable

getLog()

public getLog() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasErrors()

public hasErrors() : bool
Return values
bool

heading()

public heading(string $heading) : mixed
Parameters
$heading : string

html()

Render a log as HTML.

public static html(static|array<string|int, mixed> $log) : string
Parameters
$log : static|array<string|int, mixed>
Return values
string

isEmpty()

public isEmpty() : bool
Return values
bool

message()

public message(string $message[, bool $error = false ]) : mixed
Parameters
$message : string
$error : bool = false

print()

Print the log to the console.

public static print(static|array<string|int, mixed> $log) : void

This is formatted in markdown too.

Parameters
$log : static|array<string|int, mixed>
Return values
void —

echos output

query()

public query(string $query) : mixed
Parameters
$query : string

section()

public section(string $section) : mixed
Parameters
$section : string
On this page

Search results