Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | 1 | public function render(string $path, int $width, int $height): string |
|
18 | { |
||
19 | 1 | $docx = $this->template->getDocx(); |
|
20 | 1 | $preparedImageAttrs = $docx->prepareImageAttrs(['path' => $path, 'width' => $width, 'height' => $height]); |
|
21 | 1 | $imgPath = $preparedImageAttrs['src']; |
|
22 | |||
23 | // get image index |
||
24 | 1 | $imgIndex = $docx->getNextRelationsIndex($path); |
|
25 | 1 | $rid = 'rId' . $imgIndex; |
|
26 | |||
27 | // replace preparations |
||
28 | 1 | $docx->addImageToRelations($path, $rid, $imgPath, $preparedImageAttrs['mime']); |
|
29 | 1 | $xmlImage = str_replace(array('{RID}', '{WIDTH}', '{HEIGHT}'), array($rid, $preparedImageAttrs['width'], $preparedImageAttrs['height']), $docx->getImageTemplate()); |
|
30 | 1 | return $xmlImage; |
|
31 | } |
||
33 |