Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShortcode.php
More file actions
Latest commit
76 lines (66 loc) · 1.46 KB
/
Copy pathShortcode.php
File metadata and controls
76 lines (66 loc) · 1.46 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Shortcode
*
* @author Whizark <devaloka@whizark.com>
* @see http://whizark.com
* @copyright Copyright (C) 2015 Whizark.
* @license MIT
*/
namespaceDevaloka\Component\Shortcode;
useEcailles\CallableObject\CallableObject;
/**
* Class Shortcode
*
* @package Devaloka\Component\Shortcode
*/
class Shortcode implements ShortcodeInterface
{
use ShortcodeTrait;
/**
* @var string The tag name.
*/
protected$name;
/**
* @var callable The function.
*/
protected$callable;
/**
* @var mixed[] The default attributes.
*/
protected$defaultAttributes = [];
/**
* The constructor.
*
* @param string $name The tag name.
* @param callable $callable The callable for the Shortcode processing.
* @param mixed[] $defaultAttributes The default attributes.
*/
publicfunction__construct($name, callable$callable, array$defaultAttributes = [])
{
$this->name = $name;
$this->callable = newCallableObject($callable);
$this->defaultAttributes = $defaultAttributes;
}
/**
* {@inheritDoc}
*/
publicfunctiongetName()
{
return$this->name;
}
/**
* {@inheritDoc}
*/
publicfunctiongetCallable()
{
return$this->callable->get();
}
/**
* {@inheritDoc}
*/
publicfunctiongetDefaultAttributes()
{
return$this->defaultAttributes;
}
}