ConfigurableEnvironmentInterface::addExtension()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace League\CommonMark;
13
14
use League\CommonMark\Block\Parser\BlockParserInterface;
15
use League\CommonMark\Block\Renderer\BlockRendererInterface;
16
use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface;
17
use League\CommonMark\Extension\ExtensionInterface;
18
use League\CommonMark\Inline\Parser\InlineParserInterface;
19
use League\CommonMark\Inline\Renderer\InlineRendererInterface;
20
21
/**
22
 * Interface for an Environment which can be configured with config settings, parsers, processors, and renderers
23
 */
24
interface ConfigurableEnvironmentInterface extends EnvironmentInterface
25
{
26
    /**
27
     * @param array $config
28
     */
29
    public function mergeConfig(array $config = []);
30
31
    /**
32
     * @param array $config
33
     */
34
    public function setConfig(array $config = []);
35
36
    /**
37
     * Registers the given extension with the Environment
38
     *
39
     * @param ExtensionInterface $extension
40
     *
41
     * @return ConfigurableEnvironmentInterface
42
     */
43
    public function addExtension(ExtensionInterface $extension): ConfigurableEnvironmentInterface;
44
45
    /**
46
     * Registers the given block parser with the Environment
47
     *
48
     * @param BlockParserInterface $parser   Block parser instance
49
     * @param int                  $priority Priority (a higher number will be executed earlier)
50
     *
51
     * @return self
52
     */
53
    public function addBlockParser(BlockParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface;
54
55
    /**
56
     * Registers the given inline parser with the Environment
57
     *
58
     * @param InlineParserInterface $parser   Inline parser instance
59
     * @param int                   $priority Priority (a higher number will be executed earlier)
60
     *
61
     * @return self
62
     */
63
    public function addInlineParser(InlineParserInterface $parser, int $priority = 0): ConfigurableEnvironmentInterface;
64
65
    /**
66
     * Registers the given delimiter processor with the Environment
67
     *
68
     * @param DelimiterProcessorInterface $processor Delimiter processors instance
69
     *
70
     * @return ConfigurableEnvironmentInterface
71
     */
72
    public function addDelimiterProcessor(DelimiterProcessorInterface $processor): ConfigurableEnvironmentInterface;
73
74
    /**
75
     * @param string                 $blockClass    The fully-qualified block element class name the renderer below should handle
76
     * @param BlockRendererInterface $blockRenderer The renderer responsible for rendering the type of element given above
77
     * @param int                    $priority      Priority (a higher number will be executed earlier)
78
     *
79
     * @return self
80
     */
81
    public function addBlockRenderer($blockClass, BlockRendererInterface $blockRenderer, int $priority = 0): ConfigurableEnvironmentInterface;
82
83
    /**
84
     * Registers the given inline renderer with the Environment
85
     *
86
     * @param string                  $inlineClass The fully-qualified inline element class name the renderer below should handle
87
     * @param InlineRendererInterface $renderer    The renderer responsible for rendering the type of element given above
88
     * @param int                     $priority    Priority (a higher number will be executed earlier)
89
     *
90
     * @return self
91
     */
92
    public function addInlineRenderer(string $inlineClass, InlineRendererInterface $renderer, int $priority = 0): ConfigurableEnvironmentInterface;
93
94
    /**
95
     * Registers the given event listener
96
     *
97
     * @param string   $eventClass Fully-qualified class name of the event this listener should respond to
98
     * @param callable $listener   Listener to be executed
99
     * @param int      $priority   Priority (a higher number will be executed earlier)
100
     *
101
     * @return self
102
     */
103
    public function addEventListener(string $eventClass, callable $listener, int $priority = 0): ConfigurableEnvironmentInterface;
104
}
105