1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Interface BBCodeOutputInterface |
4
|
|
|
* |
5
|
|
|
* @filesource BBCodeOutputInterface.php |
6
|
|
|
* @created 23.04.2018 |
7
|
|
|
* @package chillerlan\BBCode\Output |
8
|
|
|
* @author smiley <[email protected]> |
9
|
|
|
* @copyright 2018 smiley |
10
|
|
|
* @license MIT |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace chillerlan\BBCode\Output; |
14
|
|
|
|
15
|
|
|
use chillerlan\Settings\SettingsContainerInterface; |
16
|
|
|
use Psr\Log\LoggerInterface; |
17
|
|
|
use Psr\SimpleCache\CacheInterface; |
18
|
|
|
|
19
|
|
|
interface BBCodeOutputInterface{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* BBCodeOutputInterface constructor. |
23
|
|
|
* |
24
|
|
|
* @param \chillerlan\Settings\SettingsContainerInterface $options |
25
|
|
|
* @param \Psr\SimpleCache\CacheInterface $cache |
26
|
|
|
* @param \Psr\Log\LoggerInterface $logger |
27
|
|
|
*/ |
28
|
|
|
public function __construct(SettingsContainerInterface $options, CacheInterface $cache, LoggerInterface $logger); |
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* returns a list of tags the output interface is able to process |
32
|
|
|
* |
33
|
|
|
* @return array |
34
|
|
|
*/ |
35
|
|
|
public function getTags():array; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* returns a list of single tag bbcodes that need to be closed before running the parser |
39
|
|
|
* |
40
|
|
|
* @return array |
41
|
|
|
*/ |
42
|
|
|
public function getSingleTags():array; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* retruns a list of tags that shouldn't run though the parser |
46
|
|
|
* |
47
|
|
|
* @return array |
48
|
|
|
*/ |
49
|
|
|
public function getNoparse():array; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function getEOL():string; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* transforms the current bbcode |
58
|
|
|
* |
59
|
|
|
* @param string $tag |
60
|
|
|
* @param array $attributes |
61
|
|
|
* @param string $content |
62
|
|
|
* @param string $match |
63
|
|
|
* @param int $callback_count |
64
|
|
|
* |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public function transform(string $tag, array $attributes, string $content, string $match, int $callback_count):string; |
68
|
|
|
|
69
|
|
|
} |
70
|
|
|
|
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.