-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathShortcodeInterface.php
More file actions
60 lines (54 loc) · 1.47 KB
/
ShortcodeInterface.php
File metadata and controls
60 lines (54 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Thunder\Shortcode\Shortcode;
/**
* @author Tomasz Kowalczyk <tomasz@kowalczyk.cc>
*/
interface ShortcodeInterface
{
/**
* Returns new instance of given shortcode with changed content
*
* @param string $content
*
* @return self
*/
public function withContent($content);
/**
* Returns shortcode name
*
* @return string
*/
public function getName();
/**
* Returns associative array(name => value) of shortcode parameters
*
* @return array
* @psalm-return array<string,string|null>
*/
public function getParameters();
/**
* Returns parameter value using its name, will return null for parameter
* without value
*
* @param string $name Parameter name
* @param string|null $default Value returned if there is no parameter with given name
*
* @return string|null
*/
public function getParameter($name, $default = null);
/**
* Returns shortcode content (data between opening and closing tag). Null
* means that shortcode had no content (was self closing), do not confuse
* that with empty string (hint: use strict comparison operator ===).
*
* @return string|null
*/
public function getContent();
/**
* Returns the so-called "BBCode" fragment when shortcode name is treated
* like a parameter, eg.: [name="value" /]
*
* @return string|null
*/
public function getBbCode();
}