Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
PolyLineAnnotation
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
2 / 2
8
100.00% covered (success)
100.00%
1 / 1
 getSubtype
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
7
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Annotation;
6
7use Phpdftk\Pdf\Core\PdfArray;
8use Phpdftk\Pdf\Core\PdfName;
9use Phpdftk\Pdf\Core\PdfReference;
10use Phpdftk\Pdf\Core\Serializable;
11use Phpdftk\Pdf\Core\PdfVersion;
12use Phpdftk\Pdf\Core\RequiresPdfVersion;
13
14/**
15 * PolyLine annotation (/Subtype /PolyLine).
16 */
17#[RequiresPdfVersion(PdfVersion::V1_5)]
18class PolyLineAnnotation extends MarkupAnnotation
19{
20    public ?PdfArray $vertices = null;  // /Vertices
21    public ?PdfArray $le = null;        // /LE - line ending styles
22    public ?PdfArray $ic = null;        // /IC - interior color
23    public ?Serializable $be = null;    // /BE - border effect
24    public ?PdfName $it = null;         // /IT - intent
25    public ?PdfReference $measure = null; // /Measure
26
27    public function getSubtype(): string
28    {
29        return 'PolyLine';
30    }
31
32    public function toPdf(): string
33    {
34        $dict = $this->buildDictionary();
35
36        if ($this->vertices !== null) {
37            $dict->set('Vertices', $this->vertices);
38        }
39        if ($this->le !== null) {
40            $dict->set('LE', $this->le);
41        }
42        if ($this->ic !== null) {
43            $dict->set('IC', $this->ic);
44        }
45        if ($this->be !== null) {
46            $dict->set('BE', $this->be);
47        }
48        if ($this->it !== null) {
49            $dict->set('IT', $this->it);
50        }
51        if ($this->measure !== null) {
52            $dict->set('Measure', $this->measure);
53        }
54
55        return $dict->toPdf();
56    }
57}