Test Failed
Push — develop ( 90366f...812a46 )
by Adrien
28:16
created

Comment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 30.76%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 4
cts 13
cp 0.3076
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A write() 0 16 2
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Writer\Ods\Cell;
4
5
use PhpOffice\PhpSpreadsheet\Cell\Cell;
6
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
7
8
/**
9
 * @category   PhpSpreadsheet
10
 *
11
 * @copyright  Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
12
 * @author     Alexander Pervakov <[email protected]>
13
 */
14
class Comment
15
{
16 2
    public static function write(XMLWriter $objWriter, Cell $cell)
17
    {
18 2
        $comments = $cell->getWorksheet()->getComments();
19 2
        if (!isset($comments[$cell->getCoordinate()])) {
20 2
            return;
21
        }
22
        $comment = $comments[$cell->getCoordinate()];
23
24
        $objWriter->startElement('office:annotation');
25
        $objWriter->writeAttribute('svg:width', $comment->getWidth());
26
        $objWriter->writeAttribute('svg:height', $comment->getHeight());
27
        $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
28
        $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
29
        $objWriter->writeElement('dc:creator', $comment->getAuthor());
30
        $objWriter->writeElement('text:p', $comment->getText()->getPlainText());
31
        $objWriter->endElement();
32
    }
33
}
34