| Total Complexity | 16 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | trait FormattingTrait |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
|
1 ignored issue
–
show
|
|||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | static $formattingAttributes = ['font-style', 'font-family', 'font-weight', 'font-variant', 'text-decoration', 'vertical-align']; |
||
| 28 | |||
| 29 | /** |
||
|
1 ignored issue
–
show
|
|||
| 30 | * @var ArrayList |
||
| 31 | */ |
||
| 32 | private $formattingOptions; |
||
| 33 | |||
| 34 | /** |
||
|
1 ignored issue
–
show
|
|||
| 35 | * @var bool |
||
| 36 | */ |
||
| 37 | private $stripPeriods = false; |
||
| 38 | |||
| 39 | /** |
||
|
1 ignored issue
–
show
|
|||
| 40 | * @var string |
||
| 41 | */ |
||
| 42 | private $format; |
||
| 43 | |||
| 44 | /** |
||
|
1 ignored issue
–
show
|
|||
| 45 | * @param SimpleXMLElement $node |
||
|
1 ignored issue
–
show
|
|||
| 46 | */ |
||
| 47 | 144 | protected function initFormattingAttributes(SimpleXMLElement $node) |
|
| 48 | { |
||
| 49 | 144 | $this->formattingOptions = new ArrayList(); |
|
| 50 | |||
| 51 | /** @var SimpleXMLElement $attribute */ |
||
|
3 ignored issues
–
show
|
|||
| 52 | 144 | foreach ($node->attributes() as $attribute) { |
|
| 53 | |||
| 54 | /** @var string $name */ |
||
|
3 ignored issues
–
show
|
|||
| 55 | 144 | $name = (string) $attribute->getName(); |
|
| 56 | 144 | $value = (string) $attribute; |
|
| 57 | |||
| 58 | 144 | if (in_array($name, self::$formattingAttributes)) { |
|
| 59 | 42 | $this->formattingOptions->add($name, $value); |
|
| 60 | 42 | continue; |
|
| 61 | } |
||
| 62 | } |
||
| 63 | 144 | } |
|
| 64 | |||
| 65 | |||
| 66 | 140 | protected function format($text) |
|
| 98 | } |
||
| 99 | } |