Failed Conditions
Push — master ( 36acc3...2eb342 )
by Adrien
36:49
created

Comment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
ccs 13
cts 13
cp 1
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 7
    public static function write(XMLWriter $objWriter, Cell $cell)
17
    {
18 7
        $comments = $cell->getWorksheet()->getComments();
19 7
        if (!isset($comments[$cell->getCoordinate()])) {
20 7
            return;
21
        }
22 1
        $comment = $comments[$cell->getCoordinate()];
23
24 1
        $objWriter->startElement('office:annotation');
25 1
        $objWriter->writeAttribute('svg:width', $comment->getWidth());
26 1
        $objWriter->writeAttribute('svg:height', $comment->getHeight());
27 1
        $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
28 1
        $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
29 1
        $objWriter->writeElement('dc:creator', $comment->getAuthor());
30 1
        $objWriter->writeElement('text:p', $comment->getText()->getPlainText());
31 1
        $objWriter->endElement();
32 1
    }
33
}
34