Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Formatter plugin interface.
4 *
5 * @package automattic/jetpack-changelogger
6 */
7
8namespace Automattic\Jetpack\Changelogger;
9
10use Automattic\Jetpack\Changelog\ChangeEntry;
11use Automattic\Jetpack\Changelog\Changelog;
12use Automattic\Jetpack\Changelog\ChangelogEntry;
13use Symfony\Component\Console\Input\InputInterface;
14use Symfony\Component\Console\Input\InputOption;
15use Symfony\Component\Console\Output\OutputInterface;
16
17/**
18 * Formatter plugin interface.
19 *
20 * This is intentionally compatible with \Automattic\Jetpack\Changelog\Parser.
21 *
22 * PluginTrait may be used to handle the boilerplate for `instantiate()`, `getOptions()` and `setIO()`.
23 */
24interface FormatterPlugin {
25
26    /**
27     * The plugin is created via this factory method.
28     *
29     * @param array $config Configuration information from composer.json.
30     */
31    public static function instantiate( array $config );
32
33    /**
34     * Define any command line options the formatter wants to accept.
35     *
36     * @return InputOption[]
37     */
38    public function getOptions();
39
40    /**
41     * Set Symfony Console input and output interfaces.
42     *
43     * @param InputInterface  $input InputInterface.
44     * @param OutputInterface $output OutputInterface.
45     */
46    public function setIO( InputInterface $input, OutputInterface $output );
47
48    /**
49     * Parse changelog data into a Changelog object.
50     *
51     * @param string $changelog Changelog contents.
52     * @return Changelog
53     */
54    public function parse( $changelog );
55
56    /**
57     * Write a Changelog object to a string.
58     *
59     * @param Changelog $changelog Changelog object.
60     * @return string
61     */
62    public function format( Changelog $changelog );
63
64    /**
65     * Create a new ChangelogEntry.
66     *
67     * @param string $version See `ChangelogEntry::__construct()`.
68     * @param array  $data See `ChangelogEntry::__construct()`.
69     * @return ChangelogEntry
70     */
71    public function newChangelogEntry( $version, $data = array() );
72
73    /**
74     * Create a new ChangeEntry.
75     *
76     * @param array $data See `ChangeEntry::__construct()`.
77     * @return ChangeEntry
78     */
79    public function newChangeEntry( $data = array() );
80}