Class Kitab\Compiler\Target\Html\Configuration

class Configuration extends Kitab\Configuration
{
}

Configuration structure for the HTML target.

This structure contains all the configuration items used by the HTML target of Kitab. It extends the default Kitab configuration structure.

Examples

$configuration              = new Kitab\Compiler\Target\Html\Configuration();
$configuration->projectName = 'Kitab';

assert('Kitab' === $configuration->projectName);

Attributes

public $defaultNamespace = null;

The default namespace of the project currently documented.

A project can contain several namespaces, either because it hosts many, or because of the dependencies. The default namespace is the entry point of the documentation. If a default namespace is provided, when the user will open the documentation, she will be automatically redirected to the default namespace.

public $logoURL = 'https://placehold.it/150x150';

URL to the logo of the documentation.

Each page contains a logo, representing a link to the “home”. It is possible to customise the logo by using this configuration item. By default, a placeholder is used.

public $projectName = '(unknown)';

Project name.

This configuration item represents the name of the project being documented.

public $composerFile = null;

Composer file.

Use a specific Composer file to get PSR-4 mappings.

public $viewSourceLinkFormatter = null;

View-source link formatter.

A closure taking an entity (Kitab\Compiler\IntermediateRepresentation\Entity) as input, and computing a relative or absolute URL as output. If null, a default formatter will be used.

Examples

The following example creates links to view source on a Github repository:

define('GITHUB_BLOB', 'https://github.com/hoaproject/Kitab/blob/master/');

$configuration = new Kitab\Compiler\Target\Html\Configuration();
$configuration->viewSourceLinkFormatter = function (Kitab\Compiler\IntermediateRepresentation\Entity $entity): string {
    return GITHUB_BLOB . $entity->file->name . '#L' . $entity->lineStart;
};