Publisher

Publishes Stuff

class Publisher
use LoggerAwareTrait
use Producer
Copyright
2016 Appertly
License
Apache-2.0

Instance Properties

Protected
NameTypeSummary
$commentParserParser

The comment parser

$mdParserDocParser

The markdown parser

$writerWriter

The file writer

Static Properties

Protected
NameTypeSummary
$primitivesImmSet<string>
$thisyImmSet<string>

Constructors / Destructors

Public
ReturnsSignature and Description
void
__construct(LoggerInterface $logger)

Create a new Publisher.

Instance Methods

Public
ReturnsSignature and Description
Awaitable<mixed>
doConstants(Job $job, string $namespace, Vector<ConstantDeclaration> $constants)

Exports the page for functions.

Awaitable<mixed>
doFunctions(Job $job, string $namespace, Vector<FunctionDeclaration> $functions)

Exports the page for functions.

void
publish(string $destination, ConstVector<ScannedBase> $tokens)

Publishes our documentation

Protected
ReturnsSignature and Description
Awaitable<mixed>

Exports the page for a class, interface, or trait.

ConstVector<Awaitable<mixed>>
doNamespace(Job $job, string $namespace, ConstVector<ScannedBase> $tokens)

Exports a single namespace.

ConstVector<Awaitable<mixed>>

Exports namespace pages.

string
getFilename(ScannedBase $c)

Cleans up a filename.

Page
getPage(string $title)

Gets a page builder.

ConstSet<string>
getSubNamespaces(Job $job, string $namespace)

Gets any sub-namespaces for a given namespace.

bool
isPrimitive(string $type)

Gets whether the provided type is primitive.

bool
isThisy(?ScannedTypehint $type)

Gets whether the provided typehint refers to $this

bool
isVoid(?ScannedTypehint $type)

Gets whether the provided typehint is void.

Property Details

$commentParser

protected Parser $commentParser

The comment parser

$mdParser

protected DocParser $mdParser

The markdown parser

$primitives

Inherited from Producer

static protected ImmSet<string> $primitives

$thisy

Inherited from Producer

static protected ImmSet<string> $thisy

$writer

protected Writer $writer

The file writer

Method Details

__construct

public function __construct(LoggerInterface $logger)

Create a new Publisher.

Parameters
NameTypeDescription
$loggerLoggerInterface

The logger

doClass

protected function doClass(Job $job, ClassyDeclaration $c)

Exports the page for a class, interface, or trait.

Parameters
NameTypeDescription
$jobJob

The export job

$cClassyDeclaration

The scanned token

Returns
TypeDescription
Awaitable<mixed>

Awaitable for writing the class

doConstants

public function doConstants(Job $job, string $namespace, Vector<ConstantDeclaration> $constants)

Exports the page for functions.

Parameters
NameTypeDescription
$jobJob

The export job

$namespacestring

The namespace to scan

$constantsVector<ConstantDeclaration>
Returns
TypeDescription
Awaitable<mixed>

Awaitable for writing the class

doFunctions

public function doFunctions(Job $job, string $namespace, Vector<FunctionDeclaration> $functions)

Exports the page for functions.

Parameters
NameTypeDescription
$jobJob

The export job

$namespacestring

The namespace to scan

$functionsVector<FunctionDeclaration>

The list of functions

Returns
TypeDescription
Awaitable<mixed>

Awaitable for writing the class

doNamespace

protected function doNamespace(Job $job, string $namespace, ConstVector<ScannedBase> $tokens)

Exports a single namespace.

Parameters
NameTypeDescription
$jobJob

The file path to contain exported pages

$namespacestring

The namespace name

$tokensConstVector<ScannedBase>

The tokens in this namespace

Returns
TypeDescription
ConstVector<Awaitable<mixed>>

The awaitables for each member of the namespace

doNamespaces

protected function doNamespaces(Job $job)

Exports namespace pages.

Parameters
NameTypeDescription
$jobJob

The job details

Returns
TypeDescription
ConstVector<Awaitable<mixed>>

The awaitables for each namespace

getFilename

Inherited from Producer

protected function getFilename(ScannedBase $c)

Cleans up a filename.

Parameters
NameTypeDescription
$cScannedBase

The scanned token

Returns
TypeDescription
string

The cleaned up filename

getPage

Inherited from Producer

protected function getPage(string $title)

Gets a page builder.

Parameters
NameTypeDescription
$titlestring

The page title

Returns
TypeDescription
Page

The page builder

getSubNamespaces

protected function getSubNamespaces(Job $job, string $namespace)

Gets any sub-namespaces for a given namespace.

Parameters
NameTypeDescription
$jobJob

The job

$namespacestring

The namespace

Returns
TypeDescription
ConstSet<string>

isPrimitive

Inherited from Producer

protected function isPrimitive(string $type)

Gets whether the provided type is primitive.

Parameters
NameTypeDescription
$typestring

The type to test

Returns
TypeDescription
bool

true if the type is primitive.

isThisy

Inherited from Producer

protected function isThisy(?ScannedTypehint $type)

Gets whether the provided typehint refers to $this

Parameters
NameTypeDescription
$type?ScannedTypehint

The typehint to test

Returns
TypeDescription
bool

true if the typehint is thisy

isVoid

Inherited from Producer

protected function isVoid(?ScannedTypehint $type)

Gets whether the provided typehint is void.

Parameters
NameTypeDescription
$type?ScannedTypehint

The typehint to test

Returns
TypeDescription
bool

true if the typehint is void

publish

public function publish(string $destination, ConstVector<ScannedBase> $tokens)

Publishes our documentation

Parameters
NameTypeDescription
$destinationstring
$tokensConstVector<ScannedBase>