Passed
Push — main ( 1a7f0e...7d39cf )
by Oscar
03:17
created

SvgTrait::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of ocubom/twig-svg-extension
5
 *
6
 * © Oscar Cubo Medina <https://ocubom.github.io>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ocubom\Twig\Extension\Svg;
13
14
use Ocubom\Twig\Extension\Svg\Util\DomHelper;
15
16
trait SvgTrait
17
{
18
    protected \DOMElement $svg;
19
20 4
    public function getElement(): \DOMElement
21
    {
22 4
        return $this->svg;
23
    }
24
25
    /**
26
     * @deprecated since ocubom/twig-svg-extension 1.1, use __toString instead
27
     *
28
     * @codeCoverageIgnore
29
     */
30
    public function render(): string
31
    {
32
        trigger_deprecation('ocubom/twig-svg-extension', '1.1', 'Using "%s" is deprecated, use "%s::_toString" instead.', __METHOD__, SvgTrait::class);
33
34
        return (string) $this;
35
    }
36
37 2
    public function __toString(): string
38
    {
39 2
        return DomHelper::toXml($this->svg);
40
    }
41
}
42