1 | <?php |
||
25 | class SVG extends Base implements ContainerInterface, ElementFactoryInterface, SVGOutputInterface |
||
26 | { |
||
27 | use ElementTrait, ChildTrait; |
||
28 | |||
29 | /** |
||
30 | * @var XMLDocumentInterface |
||
31 | */ |
||
32 | private $svg; |
||
33 | |||
34 | /** |
||
35 | * @var OutputInterface |
||
36 | */ |
||
37 | private $outputImpl; |
||
38 | |||
39 | 127 | public function __construct($width = 640, $height = 480, XMLDocumentInterface $dom = null) |
|
61 | |||
62 | /** |
||
63 | * @param array $assoc |
||
64 | * |
||
65 | * @return mixed |
||
66 | */ |
||
67 | 127 | public function apply(array $assoc) |
|
73 | |||
74 | 3 | public function getRoot() |
|
78 | |||
79 | 2 | public function getName() |
|
83 | |||
84 | /** |
||
85 | * @return DOMElement |
||
86 | */ |
||
87 | 127 | public function getElement() |
|
91 | |||
92 | 127 | public function createElement($name, $value = null, $attributes = []) |
|
100 | |||
101 | 1 | public function __toString() |
|
102 | { |
||
103 | 1 | return $this->draw(); |
|
104 | } |
||
105 | |||
106 | 45 | public function draw() |
|
110 | |||
111 | /** |
||
112 | * @inheritdoc |
||
113 | */ |
||
114 | 1 | public function copy(array $apply = [], array $ignore = [], ContainerInterface $parent = null) |
|
118 | |||
119 | /** |
||
120 | * Returns escaped svg as plain text. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | 1 | public function asString() |
|
128 | |||
129 | /** |
||
130 | * @inheritdoc |
||
131 | */ |
||
132 | 1 | public function asSVG() |
|
136 | |||
137 | /** |
||
138 | * @inheritdoc |
||
139 | */ |
||
140 | 2 | public function asSVGZ($sendHeader = false) |
|
141 | { |
||
142 | 2 | if ($sendHeader && !headers_sent()) { |
|
143 | 1 | header("Content-Encoding: gzip"); |
|
144 | 1 | } |
|
145 | |||
146 | 2 | return gzencode($this->draw(), 9); |
|
147 | } |
||
148 | |||
149 | /** |
||
150 | * @inheritdoc |
||
151 | */ |
||
152 | 1 | public function asDataUriBase64() |
|
159 | |||
160 | /** |
||
161 | * @inheritdoc |
||
162 | */ |
||
163 | 2 | public function asFile($name, $prettyPrint = false, $override = false) |
|
164 | { |
||
165 | 2 | return $this->outputImpl->file( |
|
166 | 2 | $name, |
|
167 | 2 | $this->domImpl->saveXML($prettyPrint), |
|
168 | $override |
||
169 | 2 | ); |
|
170 | } |
||
171 | |||
172 | /** |
||
173 | * @inheritdoc |
||
174 | */ |
||
175 | public function asImageFile($name, $format = IOFormat::PNG, $override = false) |
||
184 | |||
185 | /** |
||
186 | * @inheritdoc |
||
187 | */ |
||
188 | public function asImage($format = IOFormat::PNG, $sendHeader = false) |
||
196 | } |
||
197 |
This check looks for function calls that miss required arguments.