Factory

This factory attempts to create a converter given an input and output format and return that.

use phpDocumentor\Plugin\Scrybe\Converter\ConverterFactory; use phpDocumentor\Plugin\Scrybe\Converter\Format\Format;

$converter_factory = new ConverterFactory();
$converter = $converter_factory->get(
    Format::MARKDOWN, Format::HTML
);

author

Mike van Riel [email protected]

package

Default

Methods

Constructs a new factory.

__construct(array<mixed,string> $converters, \phpDocumentor\Plugin\Scrybe\Converter\Definition\Factory|null $definition_factory, \Monolog\Logger $logger) 

A Definition\Factory may optionally be passed to provide an alternate method of creating Definitions or to construct the Definition\Factory with a different Format\Collection to influence the possible options.

Arguments

$converters

array<mixed,string>

$logger

\Monolog\Logger

Retrieves a new instance of the converter necessary to convert the give input format to the given output format.

get(string $input_format, string $output_format) : \phpDocumentor\Plugin\Scrybe\Converter\ConverterInterface
Throws
\phpDocumentor\Plugin\Scrybe\Converter\Exception\ConverterNotFoundException

Arguments

$input_format

string

$output_format

string

Response

\phpDocumentor\Plugin\Scrybe\Converter\ConverterInterface

Method used to retrieve the default Definition Factory.

getDefaultDefinitionFactory() : \phpDocumentor\Plugin\Scrybe\Converter\Definition\Factory

This is used when the user has not provided their own definition factory in the constructor.

see \phpDocumentor\Plugin\Scrybe\Converter\Factory::__construct()

where this method is used.

Response

\phpDocumentor\Plugin\Scrybe\Converter\Definition\Factory

Returns a list of supported input formats for the given output format.

getSupportedInputFormats(string $given_output_format) : array<mixed,string>

Arguments

$given_output_format

string

A format definition per the constants in the Format class.

Response

array<mixed,string>

An array of format definitions per the constantst in the Format class.

Sets the converters for this Factory.

setConverters(array<mixed,\phpDocumentor\Plugin\Scrybe\Converter\ConverterInterface> $converters) : void

Sets the Definition Factory used to retrieve definitions from.

setDefinitionFactory(\phpDocumentor\Plugin\Scrybe\Converter\Definition\Factory $definition_factory) : void

Properties

definition_factory

definition_factory : \phpDocumentor\Plugin\Scrybe\Converter\Definition\Factory

converters

converters : array<mixed,\phpDocumentor\Plugin\Scrybe\Converter\ConverterInterface>

logger

logger : \Monolog\Logger
var

Type(s)

\Monolog\Logger