1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Groundskeeper\Tokens\Elements; |
4
|
|
|
|
5
|
|
|
use Groundskeeper\Tokens\Attribute; |
6
|
|
|
use Groundskeeper\Tokens\ElementTypes\EmbeddedContent; |
7
|
|
|
use Groundskeeper\Tokens\ElementTypes\FlowContent; |
8
|
|
|
use Groundskeeper\Tokens\ElementTypes\InteractiveContent; |
9
|
|
|
use Groundskeeper\Tokens\ElementTypes\OpenElement; |
10
|
|
|
use Groundskeeper\Tokens\ElementTypes\PhrasingContent; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* "object" element |
14
|
|
|
* |
15
|
|
|
* https://html.spec.whatwg.org/multipage/semantics.html#the-object-element |
16
|
|
|
*/ |
17
|
|
View Code Duplication |
class Object extends OpenElement implements FlowContent, PhrasingContent, EmbeddedContent, InteractiveContent |
|
|
|
|
18
|
|
|
{ |
19
|
1 |
|
protected function getAllowedAttributes() |
20
|
|
|
{ |
21
|
|
|
$objectAllowedAttributes = array( |
22
|
1 |
|
'/^data$/i' => Attribute::CS_STRING, |
23
|
1 |
|
'/^type$/i' => Attribute::CS_STRING, |
24
|
1 |
|
'/^typemustmatch$/i' => Attribute::CS_STRING, |
25
|
1 |
|
'/^name$/i' => Attribute::CS_STRING, |
26
|
1 |
|
'/^usemap$/i' => Attribute::CS_STRING, |
27
|
1 |
|
'/^form$/i' => Attribute::CS_STRING, |
28
|
1 |
|
'/^width$/i' => Attribute::INT, |
29
|
|
|
'/^height$/i' => Attribute::INT |
30
|
1 |
|
); |
31
|
|
|
|
32
|
1 |
|
return array_merge( |
33
|
1 |
|
$objectAllowedAttributes, |
34
|
1 |
|
parent::getAllowedAttributes() |
35
|
1 |
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
1 |
|
public function isInteractiveContent() |
39
|
|
|
{ |
40
|
1 |
|
return true; |
41
|
|
|
} |
42
|
|
|
|
43
|
1 |
|
public function isTransparentElement() |
44
|
|
|
{ |
45
|
1 |
|
return true; |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.